FluentValidation
FluentValidation copied to clipboard
Adding bUnit tests
Ok, this is what I have written so far. I have come across some issues, on which I need your feedback to.
Rule sets applied inconsistently
When validators contain rule sets, but these rule sets are not being included manually:
-
Validate
andValidateAsync
seem to ignore them - Validation messages are still triggered in the UI
Is this intended behavior?
Validation options
The syntax provided from the readme seems to be broken:
<FluentValidationValidator Options="@(options => options.IncludeRuleSets("Names"))" />
When I add this I get compiler messages, and I was unable to fix them by fiddling with the syntax or adding a private void IncludeNames(ValidationStrategy<object> options) { ... }
. Adding them by code works. The message is about the FluentValidation.Internals namespace not existing.
GetFailuresFromLastValidation
To my shame, GetFailuresFromLastValidation()
only seems to work when using ValidateAsync
, not when using Validate
. 2 tests are failing because of this, which is intended. The problem is, that only ValiadteAsync() adds the validation failures to the LastValidationResult
property. Is it possible to add this with Validate
or should we just add it as a caveat to the readme?
Please feel free to point out other issues I should test, or changes I should make!
Conclusion of #216
@chrissainty Is this the way you imagined it?
@luetm If you can update your branch, i can merge this. Thanks