public void AbortsPreviousAction() { AsyncTest.Run(async() => { var timer = new TaskTimer { Delay = TimeSpan.FromMilliseconds(1) }; bool actionInvoked = false; timer.Start(() => Task.Factory.StartNew(() => actionInvoked = true)); timer.Cancel(); await TaskEx.Delay(20); Assert.False(actionInvoked); }); }
public void AbortsPreviousAction() { AsyncTest.Run(async () => { var timer = new TaskTimer { Delay = TimeSpan.FromMilliseconds(1) }; bool actionInvoked = false; timer.Start(() => Task.Factory.StartNew(() => actionInvoked = true)); timer.Cancel(); await TaskEx.Delay(20); Assert.False(actionInvoked); }); }