-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Milestone
Description
FluentValidation version
11.0
ASP.NET version
No response
Summary
When adding multiple validation rules the TestHelper's ShouldHaveValidationErrorFor.WithoutErrorCode
throws for each and any specified error code (see MWE below). The issue was introduced by d4773d2, but I'm not yet(?) powerful enough to suggest a fix.
Steps to Reproduce
namespace FluentValidation.Tests {
using Xunit;
using FluentValidation.TestHelper;
public class WithoutErrorCodeIssue_Reproduce {
class A {
public A() { s = ""; }
public double d = 0;
public string s;
}
class AV : AbstractValidator<A> {
public AV() {
RuleFor(a => a.d).InclusiveBetween(1, 3); // remove this line this line to make the test pass
RuleFor(a => a.s).NotEmpty();
}
}
[Fact]
public void Reproduce() {
var vld = new AV();
var res = vld.TestValidate(new A());
res.ShouldHaveValidationErrorFor(a => a.s).WithoutErrorCode("abc");
}
}
}
Metadata
Metadata
Assignees
Labels
No labels