public async Task WaitAsync_ReturnsTrue_WhenOpened_BeforeWaiting() { var threshold = TimeSpan.FromSeconds(1); var gate = new ManualGate(); gate.Open(); var wasOpened = await gate.WaitAsync(threshold); Assert.True(wasOpened); }
public async Task Open_AllowsMultipleThreads() { var gate = new ManualGate(); gate.Open(); var waitResult1 = await gate.WaitAsync(TimeSpan.Zero); var waitResult2 = await gate.WaitAsync(TimeSpan.Zero); Assert.True(waitResult1 && waitResult2); }
public async Task Close_PreventsThreads_AfterBeginOpen() { var gate = new ManualGate(); gate.Open(); await gate.WaitAsync(); gate.Close(); var waitResult = await gate.WaitAsync(TimeSpan.FromSeconds(1)); Assert.False(waitResult); }