FluentValidation icon indicating copy to clipboard operation
FluentValidation copied to clipboard

Adding bUnit tests

Open luetm opened this issue 4 months ago • 3 comments

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 and ValidateAsync 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!

luetm avatar Feb 21 '24 15:02 luetm

Conclusion of #216

luetm avatar Feb 22 '24 08:02 luetm

@chrissainty Is this the way you imagined it?

luetm avatar Mar 04 '24 08:03 luetm

@luetm If you can update your branch, i can merge this. Thanks

pwelter34 avatar Mar 28 '24 16:03 pwelter34