public void NegatedValidatorReturnsSuccessForNullReference() { Validator validator = new NotNullValidator(true); ValidationResults validationResults = validator.Validate(null); Assert.IsTrue(validationResults.IsValid); }
public void NonNegatedValidatorReturnsFailureForNullReference() { Validator validator = new NotNullValidator(); ValidationResults validationResults = validator.Validate(null); Assert.IsFalse(validationResults.IsValid); IList<ValidationResult> resultsList = ValidationTestHelper.GetResultsList(validationResults); Assert.AreEqual(1, resultsList.Count); Assert.AreEqual(Resources.NonNullNonNegatedValidatorDefaultMessageTemplate, resultsList[0].Message); }
public void ReturnsFailureWithOverriddenMessageForNullReference() { string message = "overriden message"; Validator validator = new NotNullValidator(message); ValidationResults validationResults = validator.Validate(null); Assert.IsFalse(validationResults.IsValid); IList<ValidationResult> resultsList = ValidationTestHelper.GetResultsList(validationResults); Assert.AreEqual(1, resultsList.Count); Assert.AreEqual(message, resultsList[0].Message); }