public void When_ScheduleRepeatedly_action_crashes_Then_no_more_calls_will_be_scheduled()
{
IActionScheduler testScheduler = new DedicatedThreadScheduler(Sys);
var timesCalled = 0;
testScheduler.ScheduleRepeatedly(0, 10, () => { Interlocked.Increment(ref timesCalled); throw new Exception("Crash"); });
AwaitCondition(() => timesCalled >= 1);
Thread.Sleep(200); //Allow any scheduled actions to be fired.
//We expect only one of the scheduled actions to actually fire
timesCalled.ShouldBe(1);
}
}