Skip to content

Commit

Permalink
Fix test failing due to differences in DateTime.ToString behaviour on…
Browse files Browse the repository at this point in the history
… different runtimes
  • Loading branch information
JeremySkinner committed Apr 23, 2024
1 parent 65c4827 commit a5a5700
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/FluentValidation.Tests/ValidatorTesterTester.cs
Expand Up @@ -955,15 +955,15 @@ public class ValidatorTesterTester {
[Fact]
public void ShouldHaveValidationErrorFor_WithPropertyName_Only_throws() {
var validator = new InlineValidator<Person>();
validator.RuleFor(x => DateTime.Now)
validator.RuleFor(x => x.Age)
.Must((x, ct) => false)
.LessThan(new DateTime(1900, 1, 1));
.LessThan(50);
Assert.Throws<ValidationTestException>(() =>
validator.TestValidate(new Person())
.ShouldHaveValidationErrorFor("Now")
.WithErrorMessage("The specified condition was not met for 'Now'.")
validator.TestValidate(new Person { Age = 100 })
.ShouldHaveValidationErrorFor("Age")
.WithErrorMessage("The specified condition was not met for 'Age'.")
.Only()
).Message.ShouldEqual("Expected to have errors only matching specified conditions\n----\nUnexpected Errors:\n[0]: 'Now' must be less than '1/1/1900 12:00:00AM'.\n");
).Message.ShouldEqual("Expected to have errors only matching specified conditions\n----\nUnexpected Errors:\n[0]: 'Age' must be less than '50'.\n");
}

[Fact]
Expand Down

0 comments on commit a5a5700

Please sign in to comment.