Open speshulk926 opened 6 years ago
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)")]
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:
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.
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?