SetStartTime() public method

public SetStartTime ( ) : void
return void
コード例 #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();
        }
コード例 #2
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();
        }