-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Only() not throwing an error when more validation failures are present #1986
Comments
Hi @jonmsherman I believe in this case As there is only 1 error associated with the FirstName property the test passes. The call to Edit to clarify: So essentially WithErrorMessage seems to act filter here which excludes the others. However the documentation seems to suggest something different should happen. |
Hi @Aleksei-Pankratev-EPAM please could you take a look at this issue and confirm if it's behaving as you'd expect, as it's related to |
This should be fixed as of 11.2.1, please update and give it a try. @Aleksei-Pankratev-EPAM I'd appreciate a retroactive review of the fix (9c0c587). |
FluentValidation version
11.1.2
ASP.NET version
5
Summary
During unit testing, I'm using Only() for a certain property and the test is still passing even when there are multiple validation failures on different properties.
Steps to Reproduce
I used the following example code to reproduce this error:
PersonDto.cs
PersonValidator.cs
PersonValidatorTests.cs
If you debug this test, you will notice there's a validation error for both first name and middle name, but the test should fail because it's only expecting 1 validation error with that specific error message for FirstName
The text was updated successfully, but these errors were encountered: