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);
        }
Ejemplo n.º 2
0
        public void REturnsNullIfDateIsValid()
        {
            //Arrange & Act & Assert

            Assert.AreEqual(null, AgeCalculator.Age(null));
        }