public void GivenValueDoesntContainTerm_AndValidationContext_WhenValidate_ThenSucceed() { TestEntity toValidate = new TestEntity { Value = "test" }; ValidationContext validationContext = new ValidationContext(toValidate) { DisplayName = "Test Entity Value", MemberName = "Value" }; var target = new DoesNotContainAttribute("blah"); target.Validate(toValidate.Value, validationContext); }
public void GivenValueContainsTerm_AndValidationContext_WhenValidate_ThenThrowException() { TestEntity toValidate = new TestEntity { Value = "mcblah" }; ValidationContext validationContext = new ValidationContext(toValidate) { DisplayName = "Test Entity Value", MemberName = "Value" }; var target = new DoesNotContainAttribute("blah"); target.ExpectException<ValidationException>(() => target.Validate(toValidate.Value, validationContext)); }
public void GivenValueContainsTerm_AndValidationContext_WhenValidate_ThenThrowException() { TestEntity toValidate = new TestEntity { Value = "mcblah" }; ValidationContext validationContext = new ValidationContext(toValidate) { DisplayName = "Test Entity Value", MemberName = "Value" }; var target = new DoesNotContainAttribute("blah"); target.ExpectException <ValidationException>(() => target.Validate(toValidate.Value, validationContext)); }