示例#1
0
        public void RunEveryMonthOn31st()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.DayNumber = 31;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(12);

            actual.Should().Equal(new Date[] {
                new Date(2019, 10, 31),
                new Date(2019, 11, 30),
                new Date(2019, 12, 31),
                new Date(2020, 01, 31),
                new Date(2020, 02, 29),
                new Date(2020, 03, 31),
                new Date(2020, 04, 30),
                new Date(2020, 05, 31),
                new Date(2020, 06, 30),
                new Date(2020, 07, 31),
                new Date(2020, 08, 31),
                new Date(2020, 09, 30)
            });
        }
示例#2
0
        public void FirstRunDateBeforeCorrectDay()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.DayNumber = 26;

            var startDate = new Date(2019, 10, 02);

            var actual = template.GetDates(startDate).First();

            actual.Should().Be(new Date(2019, 10, 26));
        }
示例#3
0
        public void FirstRunDateOnLastWednesday()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.OccuranceType = OccuranceType.DayOfWeek;
            template.Occurance     = Occurance.Last;
            template.Day           = DayOfWeek.Wednesday;

            var startDate = new Date(2019, 10, 26);

            var actual = template.GetDates(startDate).First();

            actual.Should().Be(new Date(2019, 10, 30));
        }
示例#4
0
        public void FirstRunDateOnFourthSaturday()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.OccuranceType = OccuranceType.DayOfWeek;
            template.Occurance     = Occurance.Fourth;
            template.Day           = DayOfWeek.Saturday;

            var startDate = new Date(2019, 10, 26);

            var actual = template.GetDates(startDate).First();

            actual.Should().Be(new Date(2019, 10, 26));
        }
示例#5
0
        public void FirstRunDateOnThirdFriday()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.OccuranceType = OccuranceType.DayOfWeek;
            template.Occurance     = Occurance.Third;
            template.Day           = DayOfWeek.Friday;

            var startDate = new Date(2019, 10, 26);

            var actual = template.GetDates(startDate).First();

            actual.Should().Be(new Date(2019, 11, 15));
        }
示例#6
0
        public void RunEverySixMonthsOn10th()
        {
            var template = new MonthlyScheduleTemplate(6);

            template.DayNumber = 10;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(5);

            actual.Should().Equal(new Date[] {
                new Date(2019, 11, 10),
                new Date(2020, 05, 10),
                new Date(2020, 11, 10),
                new Date(2021, 05, 10),
                new Date(2021, 11, 10)
            });
        }
示例#7
0
        public void RunEveryMonthOn15th()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.DayNumber = 15;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(5);

            actual.Should().Equal(new Date[] {
                new Date(2019, 11, 15),
                new Date(2019, 12, 15),
                new Date(2020, 01, 15),
                new Date(2020, 02, 15),
                new Date(2020, 03, 15)
            });
        }
示例#8
0
        public void RunEveryMonthOnLastWeekDay()
        {
            var template = new MonthlyScheduleTemplate(1);

            template.OccuranceType = OccuranceType.Weekday;
            template.Occurance     = Occurance.Last;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(5);

            actual.Should().Equal(new Date[] {
                new Date(2019, 10, 31),
                new Date(2019, 11, 29),
                new Date(2019, 12, 31),
                new Date(2020, 01, 31),
                new Date(2020, 02, 28)
            });
        }
示例#9
0
        public void RunEvery2MonthsOnFirstWeekDay()
        {
            var template = new MonthlyScheduleTemplate(2);

            template.OccuranceType = OccuranceType.Weekday;
            template.Occurance     = Occurance.First;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(5);

            actual.Should().Equal(new Date[] {
                new Date(2019, 11, 01),
                new Date(2020, 01, 01),
                new Date(2020, 03, 02),
                new Date(2020, 05, 01),
                new Date(2020, 07, 01)
            });
        }
示例#10
0
        public void RunEvery2MonthsOnLastDay()
        {
            var template = new MonthlyScheduleTemplate(2);

            template.OccuranceType = OccuranceType.Day;
            template.Occurance     = Occurance.Last;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(5);

            actual.Should().Equal(new Date[] {
                new Date(2019, 10, 31),
                new Date(2019, 12, 31),
                new Date(2020, 02, 29),
                new Date(2020, 04, 30),
                new Date(2020, 06, 30)
            });
        }
示例#11
0
        public void RunEvery3MonthsOnSecondTuesday()
        {
            var template = new MonthlyScheduleTemplate(3);

            template.OccuranceType = OccuranceType.DayOfWeek;
            template.Occurance     = Occurance.Second;
            template.Day           = DayOfWeek.Tuesday;

            var startDate = new Date(2019, 10, 24);

            var actual = template.GetDates(startDate).Take(5);

            actual.Should().Equal(new Date[] {
                new Date(2019, 11, 12),
                new Date(2020, 02, 11),
                new Date(2020, 05, 12),
                new Date(2020, 08, 11),
                new Date(2020, 11, 10)
            });
        }