public void ShouldReturnFalseForValueType() { decimal testValue = 12345; Validator dateFormatValidator = new DateFormatValidator(testValue); Assert.IsFalse(dateFormatValidator.Validate()); }
public void ShouldReturnFalseForEmptyObject() { object testValue = new object(); Validator dateFormatValidator = new DateFormatValidator(testValue); Assert.IsFalse(dateFormatValidator.Validate()); }
public void ShouldReturnFalseForIncorrectDateformat() { string[] testValues = new string[] { "11032018", "some text", string.Empty }; foreach (string item in testValues) { Validator dateFormatValidator = new DateFormatValidator(item); Assert.IsFalse(dateFormatValidator.Validate()); } }
public void ShouldReturnTrueForCorrectDateformat() { string[] testValues = new string[] { "11/03/2018", "11-3-2018", "11 03 2018", "11.03.2018", "11-03-2018" }; foreach (string item in testValues) { Validator dateFormatValidator = new DateFormatValidator(item); Assert.IsTrue(dateFormatValidator.Validate()); } }