예제 #1
0
        public void TestHandleMultipleJointYearsIncludeBoxingDay()
        {
            var service = new HolidaysCalculationService();
            var hols    = MockData.GetHolidaysMultipleYears();
            var result  = service.HandleMultipleJointYears(new DateTime(2019, 12, 25), new DateTime(2020, 01, 10), hols);

            Assert.Equal(2, result);
        }
예제 #2
0
        public void TestHandleMultipleYears()
        {
            var service = new HolidaysCalculationService();
            var hols    = MockData.GetMockHolidays();
            var result  = service.HandleYears(new DateTime(2019, 02, 02), new DateTime(2021, 12, 29), hols);

            Assert.Equal(20, result);
        }
예제 #3
0
        public void TestIsTypeThreeMatchLaborDay()
        {
            var service = new HolidaysCalculationService();
            var hol     = new Holiday()
            {
                Date = new DateTime(2020, 10, 5), Type = HolidayType.Three
            };
            var result = service.IsTypeThreeMatch(hol, new DateTime(2021, 09, 25), new DateTime(2021, 10, 15));

            Assert.True(result);
        }
예제 #4
0
        public void TestIsTypeThreeMatchQueensBirthday()
        {
            var service = new HolidaysCalculationService();
            var hol     = new Holiday()
            {
                Date = new DateTime(2020, 06, 8), Type = HolidayType.Three
            };
            var result = service.IsTypeThreeMatch(hol, new DateTime(2022, 05, 17), new DateTime(2022, 06, 25));

            Assert.True(result);
        }
예제 #5
0
        public void TestIsTypeTwoMatch2()
        {
            var service = new HolidaysCalculationService();
            var hol     = new Holiday()
            {
                Date = new DateTime(2020, 05, 17), Type = HolidayType.Two
            };
            var result = service.IsTypeTwoMatch(hol, new DateTime(2020, 05, 17), new DateTime(2020, 05, 25));

            Assert.True(result);
        }
예제 #6
0
        public void TestIsTypeOneHolMatchWeekday()
        {
            var service = new HolidaysCalculationService();
            var hol     = new Holiday()
            {
                Date = new DateTime(2020, 1, 27), Type = HolidayType.One
            };
            var result = service.IsTypeOneMatch(hol, new DateTime(2020, 1, 15), new DateTime(2020, 3, 12));

            Assert.True(result);
        }
예제 #7
0
        public void TestIsTypeOneHolMatchWeekend()
        {
            var service = new HolidaysCalculationService();
            var hol     = new Holiday()
            {
                Date = new DateTime(2020, 4, 25), Type = HolidayType.One
            };
            var result = service.IsTypeOneMatch(hol, new DateTime(2020, 3, 25), new DateTime(2020, 5, 25));

            Assert.False(result);
        }
예제 #8
0
        public void TestGetEasterSunday()
        {
            var service    = new HolidaysCalculationService();
            var result2018 = service.GetEasterSunday(2018);
            var result2019 = service.GetEasterSunday(2019);
            var result2020 = service.GetEasterSunday(2020);
            var result2021 = service.GetEasterSunday(2021);
            var result2022 = service.GetEasterSunday(2022);

            Assert.Equal(new DateTime(2018, 04, 01), result2018);
            Assert.Equal(new DateTime(2019, 04, 21), result2019);
            Assert.Equal(new DateTime(2020, 04, 12), result2020);
            Assert.Equal(new DateTime(2021, 04, 4), result2021);
            Assert.Equal(new DateTime(2022, 04, 17), result2022);
        }