示例#1
0
        public void GetNextHoliday_ReturnsNull_IfThereIsNoMoreHolidays()
        {

            //Arrange
            HolidaysManager manager = new HolidaysManager();
            manager.AddHoliday(new DateTime(2017, 5, 3));
            DateTime baseDate = new DateTime(2017, 5, 4);

            //Act
            DateTime? result = manager.GetNextHoliday(baseDate);

            //Assert
            Assert.IsNull(result);

        }
示例#2
0
        public void GetNextHolidayWithEndDate_ReturnsNull_IfThereAreHolidaysOnlyAfterEndDate()
        {

            //Arrange
            HolidaysManager manager = new HolidaysManager();
            manager.AddHoliday(new DateTime(2017, 5, 3));
            DateTime startDate = new DateTime(2017, 4, 2);
            DateTime endDate = new DateTime(2017, 4, 21);

            //Act
            DateTime? result = manager.GetNextHoliday(startDate, endDate);

            //Assert
            Assert.IsNull(result);

        }
示例#3
0
        public void GetNextHoliday_ReturnsClosestRegisteredHoliday()
        {

            //Arrange
            HolidaysManager manager = new HolidaysManager();
            manager.AddHoliday(new DateTime(2017, 5, 1));
            manager.AddHoliday(new DateTime(2017, 5, 3));
            manager.AddHoliday(new DateTime(2017, 11, 11));
            DateTime baseDate = new DateTime(2017, 5, 2);

            //Act
            DateTime? date = manager.GetNextHoliday(baseDate);

            //Assert
            DateTime expectedDate = new DateTime(2017, 5, 3);
            Assert.AreEqual(expectedDate, date);

        }