-
Notifications
You must be signed in to change notification settings - Fork 123
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 Addition Nullable Value #172
Comments
Does anyone have any suggestions? Thanks! |
It is one of the null-related traps. Take a look at the following expression: When evaluated by EA parser, it results in Such an expression is then passed to browser. At client-side, there is no separate parser built by EA. Instead, As a workaround I propose to be explicit of how you treats
|
I'm getting a parser error System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.DataAnnotations.ValidationException: AssertThatValidator: validation applied to Adults field failed. ---> ExpressiveAnnotations.Analysis.ParseErrorException: Parse error on line 1, column 29: ... ? 0 : Children)) <= MaxPeople ... ^--- Argument types must match. [AssertThat("(Adults + (Children == null ? 0 : Children)) <= MaxPeople", ErrorMessage = "Cannot exceed {MaxPeople} people")] |
Indeed, implicit types conversion has been missing for operands of conditional operator... The fixed implementation is provided with the changeset fa765b3. Will be shipped within next version. |
How long before the next release? Thanks
On Sep 16, 2017, at 6:08 PM, Jarosław Waliszko <notifications@github.com<mailto:notifications@github.com>> wrote:
Indeed, implicit types conversion has been missing for operands of conditional operator. The implementation is provided with the changeset fa765b3<fa765b3>. Will be shipped within next version.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#172 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AIyqOzHmHnUv28Hr-12tpOc-sLe2xS8Uks5sjFT3gaJpZM4PO9Kx>.
|
Most likely it should be released somewhere this week. |
Released with v2.9.6. |
The Children property can be null. If it is null this doesn't evaluate properly. I'm not sure but I assume if Adults is 1 and Children is null then Adults + Children = null. Is there a way to handle this scenario?
[AssertThat("(Adults + Children) <= MaxPeople", ErrorMessage = "Cannot exceed {MaxPeople} people")]
The text was updated successfully, but these errors were encountered: