Example #1
0
        public void IsValidReturnsFalseForDateBeforeToday()
        {
            var attribute = new UpToYearAttribute();

            var isValid = attribute.IsValid(DateTime.UtcNow.AddDays(-1));

            Assert.False(isValid);
        }
Example #2
0
        public void IsValidReturnsTrueForDateInBetweenNowAndOneYearAhead()
        {
            var attribute = new UpToYearAttribute();

            var isValid = attribute.IsValid(DateTime.UtcNow.AddMonths(6));

            Assert.True(isValid);
        }
Example #3
0
        public void IsValidReturnsFalseForDateAfterAYear()
        {
            var attribute = new UpToYearAttribute();

            var isValid = attribute.IsValid(DateTime.UtcNow.AddYears(1).AddSeconds(1));

            Assert.False(isValid);
        }