CheckResults() public method

public CheckResults ( ) : void
return void
Beispiel #1
0
        public void TestStartEnabled()
        {
            SchedulerTester.WaitForStartOfSecond();

            SchedulerTester  schedulerTester = new SchedulerTester();
            PeriodicSchedule schedule        = new PeriodicSchedule(hour: Hour.Every, minute: Minute.Every, second: Second.Every);
            List <TimeSpan>  expectedResults = new List <TimeSpan>
            {
                new TimeSpan(0, 0, 1),
                new TimeSpan(0, 0, 2),
                new TimeSpan(0, 0, 3),
                new TimeSpan(0, 0, 4),
                new TimeSpan(0, 0, 5),
                new TimeSpan(0, 0, 6),
                new TimeSpan(0, 0, 7),
                new TimeSpan(0, 0, 8),
                new TimeSpan(0, 0, 9)
            };

            schedulerTester.SetStartTime();

            schedulerTester.AddTest(Scheduler.Add <DateTime>(schedule, SchedulerTester.TestFunction, enabled: true),
                                    expectedResults);

            while (!schedulerTester.Completed())
            {
                Thread.Sleep(10);
            }
            schedulerTester.Stop();

            schedulerTester.CheckResults();
        }
Beispiel #2
0
        public void TestDisable()
        {
            SchedulerTester.WaitForStartOfSecond();

            SchedulerTester schedulerTester = new SchedulerTester();

            PeriodicSchedule schedule        = new PeriodicSchedule(hour: Hour.Every, minute: Minute.Every, second: Second.Every);
            List <TimeSpan>  expectedResults = new List <TimeSpan>
            {
                new TimeSpan(0, 0, 1),
                new TimeSpan(0, 0, 2),
                new TimeSpan(0, 0, 3),
                new TimeSpan(0, 0, 4),
                new TimeSpan(0, 0, 5),
                new TimeSpan(0, 0, 6),
                new TimeSpan(0, 0, 7),
                new TimeSpan(0, 0, 8),
                new TimeSpan(0, 0, 9)
            };

            schedulerTester.AddTest(schedule, expectedResults);

            schedule        = new PeriodicSchedule(hour: Hour.Every, minute: Minute.Every, second: Second.Every);
            expectedResults = new List <TimeSpan>
            {
                new TimeSpan(0, 0, 6),
                new TimeSpan(0, 0, 7),
                new TimeSpan(0, 0, 8),
                new TimeSpan(0, 0, 9)
            };
            IScheduledFunction <DateTime> scheduledFunction = schedulerTester.AddTest(schedule, expectedResults);

            schedulerTester.Start();

            Thread.Sleep(200);
            Scheduler.Disable(scheduledFunction);
            Thread.Sleep(6000);
            Scheduler.Enable(scheduledFunction);

            while (!schedulerTester.Completed())
            {
                Thread.Sleep(10);
            }
            schedulerTester.Stop();

            schedulerTester.CheckResults();
        }
        public void TestStartEnabled()
        {
            SchedulerTester.WaitForStartOfSecond();

            SchedulerTester schedulerTester = new SchedulerTester();
            PeriodicSchedule schedule = new PeriodicSchedule(hour: Hour.Every, minute: Minute.Every, second: Second.Every);
            List<TimeSpan> expectedResults = new List<TimeSpan>
                                                 {
                                                     new TimeSpan(0, 0, 1),
                                                     new TimeSpan(0, 0, 2),
                                                     new TimeSpan(0, 0, 3),
                                                     new TimeSpan(0, 0, 4),
                                                     new TimeSpan(0, 0, 5),
                                                     new TimeSpan(0, 0, 6),
                                                     new TimeSpan(0, 0, 7),
                                                     new TimeSpan(0, 0, 8),
                                                     new TimeSpan(0, 0, 9)
                                                 };

            schedulerTester.SetStartTime();

            schedulerTester.AddTest(Scheduler.Add<DateTime>(schedule, SchedulerTester.TestFunction, enabled: true),
                                    expectedResults);

            while (!schedulerTester.Completed())
            {
                Thread.Sleep(10);
            }
            schedulerTester.Stop();

            schedulerTester.CheckResults();
        }
        public void TestRemove()
        {
            SchedulerTester.WaitForStartOfSecond();

            SchedulerTester schedulerTester = new SchedulerTester();

            PeriodicSchedule schedule = new PeriodicSchedule(hour: Hour.Every, minute: Minute.Every, second: Second.Every);
            List<TimeSpan> expectedResults = new List<TimeSpan>
                                                 {
                                                     new TimeSpan(0, 0, 1),
                                                     new TimeSpan(0, 0, 2),
                                                     new TimeSpan(0, 0, 3),
                                                     new TimeSpan(0, 0, 4),
                                                     new TimeSpan(0, 0, 5),
                                                     new TimeSpan(0, 0, 6),
                                                     new TimeSpan(0, 0, 7),
                                                     new TimeSpan(0, 0, 8),
                                                     new TimeSpan(0, 0, 9)
                                                 };
            schedulerTester.AddTest(schedule, expectedResults);

            schedule = new PeriodicSchedule(hour: Hour.Every, minute: Minute.Every, second: Second.Every);
            expectedResults = new List<TimeSpan>
                                  {
                                      new TimeSpan(0, 0, 1)
                                  };
            IScheduledFunction<DateTime> scheduledFunction = schedulerTester.AddTest(schedule, expectedResults);

            schedulerTester.Start();

            Thread.Sleep(1500);
            Scheduler.Remove(scheduledFunction);

            while (!schedulerTester.Completed())
            {
                Thread.Sleep(10);
            }
            schedulerTester.Stop();

            schedulerTester.CheckResults();
        }