コード例 #1
0
        public void OnlyRunTime()
        {
            var template = new ExactTimeScheduleTemplate(13, 32);

            var actual = template.GetTimes();

            actual.Should().Equal(new Time[] { new Time(13, 32, 00) });
        }
コード例 #2
0
        public void DailyAt14_30()
        {
            var dateTemplate = new DailyScheduleTemplate();
            var timeTemplate = new ExactTimeScheduleTemplate(14, 30);
            var template     = new ScheduleTemplate(dateTemplate, timeTemplate);

            var startDate = new DateTime(2019, 10, 23, 04, 34, 56);

            var schedule = new ScheduleInstance(template, startDate);

            schedule.Take(5).Should().Equal(new DateTime[] {
                new DateTime(2019, 10, 23, 14, 30, 00),
                new DateTime(2019, 10, 24, 14, 30, 00),
                new DateTime(2019, 10, 25, 14, 30, 00),
                new DateTime(2019, 10, 26, 14, 30, 00),
                new DateTime(2019, 10, 27, 14, 30, 00)
            });
        }
コード例 #3
0
        public void WeeklyEveryMondayAt17_30()
        {
            var dateTemplate = new WeeklyScheduleTemplate(1);

            dateTemplate[DayOfWeek.Monday] = true;
            var timeTemplate = new ExactTimeScheduleTemplate(17, 30);

            var template = new ScheduleTemplate(dateTemplate, timeTemplate);

            var startDate = new DateTime(2019, 10, 23, 04, 34, 56);

            var schedule = new ScheduleInstance(template, startDate);

            schedule.Take(5).Should().Equal(new DateTime[] {
                new DateTime(2019, 10, 28, 17, 30, 00),
                new DateTime(2019, 11, 04, 17, 30, 00),
                new DateTime(2019, 11, 11, 17, 30, 00),
                new DateTime(2019, 11, 18, 17, 30, 00),
                new DateTime(2019, 11, 25, 17, 30, 00)
            });
        }