Blazored / FluentValidation

A library for using FluentValidation with Blazor
https://blazored.github.io/FluentValidation/
MIT License
597 stars 85 forks source link

Adding bUnit tests #218

Closed luetm closed 6 months ago

luetm commented 9 months ago

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:

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 commented 9 months ago

Conclusion of #216

luetm commented 8 months ago

@chrissainty Is this the way you imagined it?

pwelter34 commented 8 months ago

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