public async Task Release() { var a = new AsyncManualResetEventEx(); _ = Task.Delay(2000).ContinueWith(_ => a.Set()); var sw = Stopwatch.StartNew(); await a.WaitAsync(); sw.Stop(); Assert.InRange(sw.ElapsedMilliseconds, 2000, 10_000); }
public async Task NotTimedOut() { var a = new AsyncManualResetEventEx(); _ = Task.Delay(500).ContinueWith(_ => a.Set()); var sw = Stopwatch.StartNew(); bool success = await a.WaitAsync(1000); sw.Stop(); Assert.InRange(sw.ElapsedMilliseconds, 500, 2000); Assert.True(success); }