예제 #1
0
        public void Monthly_FirstSaturday_MonthlyPeriod_1()
        {
            WashingDayDefinition wd = new WashingDayDefinition();
            AlarmController      ac = new AlarmController(null, null, null);

            WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac);

            wdc.GetModel().Scheduled.Type = ScheduleDefinition.ScheduleType.Monthly;
            wdc.GetModel().Scheduled.MonthlyPeriod.Period = 1;
            wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 1);
            wdc.GetModel().Scheduled.MonthlyPeriod.Type = ScheduleDefinition.Monthly.ScheduleType.First;
            wdc.GetModel().Scheduled.MonthlyPeriod.WeekDay = DayOfWeek.Saturday;

            var controller = wdc.GetScheduleController();
            var days       = controller.GetScheduledDays();
        }
예제 #2
0
        public void Monthly_SecondSaturday_BeforeStart_MonthlyPeriod_2()
        {
            WashingDayDefinition wd = new WashingDayDefinition();
            AlarmController      ac = new AlarmController(null, null, null);

            WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac);

            wdc.GetModel().Scheduled.Type = ScheduleDefinition.ScheduleType.Monthly;
            wdc.GetModel().Scheduled.MonthlyPeriod.Period = 2;
            wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 23);
            wdc.GetModel().Scheduled.MonthlyPeriod.Type = ScheduleDefinition.Monthly.ScheduleType.First;
            wdc.GetModel().Scheduled.MonthlyPeriod.WeekDay = DayOfWeek.Saturday;

            var controller = wdc.GetScheduleController();
            var days       = controller.GetScheduledDays();

            Assert.AreEqual(new DateTime(2019, 3, 2), days[0]);
            Assert.AreEqual(new DateTime(2019, 5, 4), days[1]);
        }
예제 #3
0
        public void Time2CareDay_is0()
        {
            WashingDayDefinition wd = new WashingDayDefinition();
            AlarmController      ac = new AlarmController(null, null, null);

            WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac);

            wdc.GetModel().Scheduled.WeeklyPeriod.WeekDays = new System.Collections.Generic.List <DayOfWeek>
            {
                DayOfWeek.Sunday,
                DayOfWeek.Thursday
            };
            wdc.GetModel().Scheduled.WeeklyPeriod.Period = 2;
            wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 5);

            var controller = wdc.GetScheduleController();


            Assert.AreEqual(0, controller.Time2NextCareDay(new DateTime(2019, 2, 7)));
        }