예제 #1
0
        public void IsValidReturnsFalseForYearAfterCurrentYear()
        {
            var attribute = new CurrentYearMaxValueAttribute(1990);
            var isValid   = attribute.IsValid(DateTime.UtcNow.AddYears(1).Year);

            Assert.False(isValid);
        }
예제 #2
0
        public void IsValidReturnsTrueForDateTimeBeforeCurrentYear()
        {
            var attribute = new CurrentYearMaxValueAttribute(1990);
            var isValid   = attribute.IsValid(DateTime.UtcNow.AddYears(-1));

            Assert.True(isValid);
        }
예제 #3
0
        public void IsValidReturnsFalseForDateTimefterCurrentYear()
        {
            //Arrange
            var attribute = new CurrentYearMaxValueAttribute(1990);
            //Act
            var isValid = attribute.IsValid(DateTime.UtcNow.AddYears(1));

            //Assert
            Assert.False(isValid);
        }
예제 #4
0
        public void IsValidReturnsTrueForYearBeforeCurrentYear()
        {
            // Arange
            var attribute = new CurrentYearMaxValueAttribute(1990);

            // Act
            var isValid = attribute.IsValid(DateTime.UtcNow.AddYears(-1).Year);

            // Assert
            Assert.True(isValid);
        }
예제 #5
0
        public void IsValidReturnsTrueForIntYearsAfterCurrentYear()
        {
            // Arrange
            var attribute = new CurrentYearMaxValueAttribute(1990);

            // Act
            var isValid = attribute.IsValid(2021);

            // Assert
            Assert.True(isValid);
        }