コード例 #1
0
        public void TestNextWorkingDayBoxingDay()
        {
            var expected = new DateTime(2006, 12, 27);
            var actual   = new CzechRepublicPublicHoliday().NextWorkingDay(new DateTime(2006, 12, 26));

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void TestNextWorkingDayChristmasEve2014()
        {
            var expected = new DateTime(2014, 12, 29);
            var actual   = new CzechRepublicPublicHoliday().NextWorkingDay(new DateTime(2014, 12, 24));

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void TestNextWorkingDayEaster()
        {
            var expected = new DateTime(2017, 4, 18);
            var actual   = new CzechRepublicPublicHoliday().NextWorkingDay(new DateTime(2017, 4, 14));

            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void TestNextWorkingDaySunday()
        {
            var expected = new DateTime(2017, 6, 12);
            var actual   = new CzechRepublicPublicHoliday().NextWorkingDay(new DateTime(2017, 6, 11));

            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void TestCzNoHolidays2001(int month, int day)
        {
            var holiday         = new DateTime(2001, month, day);
            var holidayCalendar = new CzechRepublicPublicHoliday();
            var actual          = holidayCalendar.IsPublicHoliday(holiday);

            Assert.IsFalse(actual, $"{holiday.ToString("D")} is a holiday (shouldn't be)");
        }
コード例 #6
0
        public void TestCzHolidays2001(int month, int day)
        {
            var holiday         = new DateTime(2001, month, day);
            var holidayCalendar = new CzechRepublicPublicHoliday();
            var actual          = holidayCalendar.IsPublicHoliday(holiday);

            Assert.IsTrue(actual, $"{holiday.ToString("D")} is not a holiday");
        }
コード例 #7
0
        public void TestGoodFriday()
        {
            var expected = new DateTime(2017, 4, 14);
            var actual   = CzechRepublicPublicHoliday.GoodFriday(2017);

            Assert.AreEqual(expected, actual);

            expected = new DateTime(2016, 3, 25);
            actual   = CzechRepublicPublicHoliday.GoodFriday(2016);
            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
        public void TestEasterMonday()
        {
            var expected = new DateTime(2017, 4, 17);
            var actual   = CzechRepublicPublicHoliday.EasterMonday(2017);

            Assert.AreEqual(expected, actual);

            expected = new DateTime(2000, 4, 24);
            actual   = CzechRepublicPublicHoliday.EasterMonday(2000);
            Assert.AreEqual(expected, actual);

            expected = new DateTime(2005, 3, 28);
            actual   = CzechRepublicPublicHoliday.EasterMonday(2005);
            Assert.AreEqual(expected, actual);
        }
コード例 #9
0
        public void TestPreviousWorkingDay()
        {
            var actual = new CzechRepublicPublicHoliday().PreviousWorkingDay(new DateTime(2016, 1, 1)); //Friday

            Assert.AreEqual(new DateTime(2015, 12, 31), actual);

            actual = new CzechRepublicPublicHoliday().PreviousWorkingDay(new DateTime(2014, 12, 28)); // Sunday
            Assert.AreEqual(new DateTime(2014, 12, 23), actual);

            actual = new CzechRepublicPublicHoliday().PreviousWorkingDay(new DateTime(2014, 12, 29)); // Monday
            Assert.AreEqual(new DateTime(2014, 12, 29), actual);

            actual = new CzechRepublicPublicHoliday().PreviousWorkingDay(new DateTime(2016, 1, 3)); // Sunday
            Assert.AreEqual(new DateTime(2015, 12, 31), actual);

            actual = new CzechRepublicPublicHoliday().PreviousWorkingDay(new DateTime(2016, 1, 4));               // Monday
            Assert.AreEqual(new DateTime(2016, 1, 4), actual);                                                    //is a working day

            actual = new CzechRepublicPublicHoliday().PreviousWorkingDay(new DateTime(2016, 1, 3, 11, 31, 0, 0)); //Sun with date
            Assert.AreEqual(new DateTime(2015, 12, 31), actual);
        }