public override bool IsValid(object value) { var date = value as DateTime?; var age = _ageCalculator.Age(date); bool tooYoung = age < _minAge; bool tooOld = age > _maxAge; return(!tooYoung && !tooOld); }
public void REturnsNullIfDateIsValid() { //Arrange & Act & Assert Assert.AreEqual(null, AgeCalculator.Age(null)); }