public void Length_WhenSerialisedReturnsCorrectValues() { var forenameRules = TestListingHelper.GetDeserialisedValidatorRules(TestListingHelper.GetValidatorRules(v => v.RuleFor(x => x.Forename).Length(2, 10)))["validatorList"]["forename"]["length"]; forenameRules["min"].ToObject <int>().Should().Be(2); forenameRules["max"].ToObject <int>().Should().Be(10); }
public void InclusiveBetween_WhenSerialisedReturnsCorrectValues() { var anotherIntRules = TestListingHelper.GetDeserialisedValidatorRules(TestListingHelper.GetValidatorRules(v => v.RuleFor(x => x.AnotherInt).InclusiveBetween(2, 10)))["validatorList"]["anotherInt"]["range"]; anotherIntRules["from"].ToObject <int>().Should().Be(2); anotherIntRules["to"].ToObject <int>().Should().Be(10); }
public void WhenSerialised_ReturnsCorrectMessage() => TestListingHelper.GetDeserialisedValidatorRules(TestListingHelper.GetValidatorRules(v => v.RuleFor(x => x.Forename).NotEmpty()))["errorList"]["forename"]["required"].ToString().Should().Be("'Forename' must not be empty.");