static async Task Sleeper(Verify verify) { verify.WriteLine("Before"); await Task.Delay(1000); verify.WriteLine("After"); }
static async Task NumericSleeper(Verify verify, int i) { verify.WriteLine("Before " + i); await Task.Delay(1000); verify.WriteLine("After " + i); }
static Task SleeperManualStart(Verify verify) { return(new Task(() => { verify.WriteLine("Before"); Thread.Sleep(1000); verify.WriteLine("After"); })); }
static Task NumericSleeperManualStart(Verify verify, int i) { return(new Task(() => { verify.WriteLine("Before " + i); Thread.Sleep(1000); verify.WriteLine("After " + i); })); }
static async Task LongSleeper(Verify verify, CancellationToken token) { verify.WriteLine("Before"); for (var i = 0; i < 10; i++) { await Task.Delay(1000); token.ThrowIfCancellationRequested(); } verify.WriteLine("After"); }
static Task NumericSleeperManualStart(Verify verify, int i) { return new Task(() => { verify.WriteLine("Before " + i); Thread.Sleep(1000); verify.WriteLine("After " + i); }); }
static Task SleeperManualStart(Verify verify) { return new Task(() => { verify.WriteLine("Before"); Thread.Sleep(1000); verify.WriteLine("After"); }); }