Beispiel #1
0
        public void Test3()
        {
            var holidayCalendar = new HolidayCalendar();

            holidayCalendar.AddHolidayRules(new DayOfMonthHolidayRule(1, 1));
            holidayCalendar.AddHolidayRules(new DayOfMonthHolidayRule(12, 25));
            var aNavidad      = new DateTime(2014, 12, 25);
            var aJanuaryFirst = new DateTime(2014, 1, 1);

            Assert.IsTrue(holidayCalendar.IsHoliday(aNavidad));
            Assert.IsTrue(holidayCalendar.IsHoliday(aJanuaryFirst));
        }
Beispiel #2
0
        public void MoreThanOneDayOfWeekCanBeHoliday()
        {
            var holidayCalendar = new HolidayCalendar();

            holidayCalendar.AddHolidayRules(new DayOfWeekHolidayRule(DayOfWeek.Sunday));
            holidayCalendar.AddHolidayRules(new DayOfWeekHolidayRule(DayOfWeek.Saturday));
            var aSunday   = new DateTime(2014, 3, 2);
            var aSaturday = new DateTime(2014, 3, 2);

            Assert.IsTrue(holidayCalendar.IsHoliday(aSunday));
            Assert.IsTrue(holidayCalendar.IsHoliday(aSaturday));
        }
Beispiel #3
0
        public void DayOfWeekCanNotBeHoliday()
        {
            var holidayCalendar = new HolidayCalendar();
            var aMonday         = new DateTime(2014, 3, 3);

            Assert.IsFalse(holidayCalendar.IsHoliday(aMonday));
        }
Beispiel #4
0
        public void Test5()
        {
            var holidayCalendar = new HolidayCalendar();
            var aDate           = new DateTime(1998, 3, 2);

            holidayCalendar.AddHolidayRules(new CompoundRangeHolidayRule(new DateTime(1990, 1, 1), new DateTime(1999, 12, 31), new DayOfWeekHolidayRule(DayOfWeek.Monday)));
            Assert.IsTrue(holidayCalendar.IsHoliday(aDate));
        }
Beispiel #5
0
        public void Test4()
        {
            var holidayCalendar = new HolidayCalendar();
            var aDate           = new DateTime(2014, 1, 12);

            holidayCalendar.AddHolidayRules(new DateHolidayRule(aDate));
            Assert.IsTrue(holidayCalendar.IsHoliday(aDate));
        }
Beispiel #6
0
        public void Test2()
        {
            var holidayCalendar = new HolidayCalendar();

            holidayCalendar.AddHolidayRules(new DayOfMonthHolidayRule(1, 1));
            var aNavidad = new DateTime(2014, 12, 25);

            Assert.IsFalse(holidayCalendar.IsHoliday(aNavidad));
        }