public void MaxAgeRequirementTest() { var birthdayValidator = new BirthdayValidator(); birthdayValidator.MaximumAgeRequired = 99; var birthDay1 = DateTime.Today.AddYears(-98); var birthDay2 = DateTime.Today.AddYears(-100); var result1 = birthdayValidator.IsValid(birthDay1); var result2 = birthdayValidator.IsValid(birthDay2); Assert.IsTrue(result1); Assert.IsFalse(result2); }
public void BirthdayValidator_ReturnsTrue() { string[] input = new string[] { "19.09.2000", "01.01.1900", "31.01.2021" }; BirthdayValidator bdayValidator = new BirthdayValidator(); foreach (var item in input) { bool result = bdayValidator.IsValid(item); Assert.IsTrue(result); } }
public void BirthdayValidator_ReturnsFalse() { string[] input = new string[] { "19/09/2000", "01-01-1900", "31.01.2022" }; BirthdayValidator bdayValidator = new BirthdayValidator(); int i = 0; foreach (var item in input) { bool result = bdayValidator.IsValid(item); Assert.IsFalse(result); i++; } }