Start() public méthode

Starts the scheduler.
public Start ( ) : void
Résultat void
        public void Scheduler_CanBeDisabled()
        {
            foreach (string time in SimpleScheduler.DisablingValues)
            {
                bool wasCalled = false;

                using (SimpleScheduler scheduler = new SimpleScheduler(() => wasCalled = true, time))
                {
                    scheduler.Start();

                    scheduler.IsRunning.Should().BeFalse();
                    wasCalled.Should().BeFalse();
                }
            }
        }
        public void Scheduler_ExecutesAction()
        {
            bool wasCalled = false;

            // time to call the action
            TimeSpan time = DateTime.Now.TimeOfDay.Add(TimeSpan.FromSeconds(1));
            string nextSecond = time.ToString(@"hh\:mm\:ss", System.Globalization.CultureInfo.InvariantCulture);

            using (SimpleScheduler scheduler = new SimpleScheduler(() => wasCalled = true, nextSecond))
            {
                scheduler.Start();

                System.Threading.Thread.Sleep(2000);

                // due to strange timings this test might fail. incrementing the wait time might help
                wasCalled.Should().BeTrue();
            }
        }