public void CanNumberRequiredBeEnforcedWithDefaultMessage() { var rules = new NumberTestSubjectRules(); var result = rules.Validate(new NumberTestSubject { }); Assert.IsTrue(result.Errors.Any(e => e.Name == "TestNumber3_IsRequired" && e.Message == "The 'TestNumber3' property is required.")); }
public void CanNumberRequiredBeEnforcedWithMessage() { var rules = new NumberTestSubjectRules(); var result = rules.Validate(new NumberTestSubject { }); Assert.IsTrue(result.Errors.Any(e => e.Name == "TestNumber2_IsRequired")); }
public void CanNumberMinimumBeEnforcedWithMessageLambda() { var rules = new NumberTestSubjectRules(); var testSubject = new NumberTestSubject { TestNumber1 = 1 }; var result = rules.Validate(testSubject); Assert.IsTrue(result.Errors.Any(e => e.Name == "TestNumber1_MinimumValue")); testSubject.TestNumber1 = 10; result = rules.Validate(testSubject); Assert.IsFalse(result.Errors.Any(e => e.Name == "TestNumber1_MinimumValue")); }