Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertThat Condition failing #194

Open
speshulk926 opened this issue Oct 15, 2018 · 1 comment
Open

AssertThat Condition failing #194

speshulk926 opened this issue Oct 15, 2018 · 1 comment

Comments

@speshulk926
Copy link

I have stared at this way too long, so I'm hoping you can shed some light on why this condition is failing when it should not be. I'm using CompareOrdinalIgnoreCase because the values come from a database and I can't guarantee that they will always be the correct case.

Issue: On client side, this functions as expected. On server side, I get the error described below. I believe this works client side because of the way we are hiding/showing div's. If you selected a radio button for "partial", it shows the partial ProratedAmount box. You key into that box an amount > you are supposed to. You then switch it off of "partial" and it allows you to submit client side because the div is now hidden.

Expected Result:

  • No error if WithdrawalAmountSelection is not 'partial'.
  • Error should show if WithdrawalAmountSelection is 'partial' and ProratedAmount is <= the WithdrawalInvestmentTotalCurrentValue

public string WithdrawalAmountSelection { get; set; }
public decimal ProratedAmount { get; set; }
public decimal WithdrawalInvestmentTotalCurrentValue { get; } // Read-only getter that returns the total amount

[AssertThat("(CompareOrdinalIgnoreCase(WithdrawalAmountSelection, 'partial') == -1) || (CompareOrdinalIgnoreCase(WithdrawalAmountSelection, 'partial') == 0 && ProratedAmount <= WithdrawalInvestmentTotalCurrentValue)")]

The first part of the equation should be satisfied as the 'WithdrawalAmountSelection' does not have 'partial' in it.
image

Then the error I get is:
"Assertion for Prorated Amount field is not satisfied by the following logic: (CompareOrdinalIgnoreCase(WithdrawalAmountSelection, 'partial') == -1) || (CompareOrdinalIgnoreCase(WithdrawalAmountSelection, 'partial') == 0 && ProratedAmount <= WithdrawalInvestmentTotalCurrentValue)"

Is there a way to debug this to see what I'm getting?

@speshulk926
Copy link
Author

Just thought I'd reply and say that I tried it this way instead and seems to be working. It's not case-insensitive, but does seem to be working now and what I need for today.

[AssertThat("(WithdrawalAmountSelection != 'partial') || (WithdrawalAmountSelection == 'partial' && ProratedAmount <= WithdrawalInvestmentTotalCurrentValue)")]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant