public static void CheckStateTransitions(long initCount, long increms, bool takeAllAtOnce) { using (var ev = new AsyncCountdownEvent(initCount)) { Equal(initCount, ev.InitialCount); // Increment (optionally). for (var i = 1; i < increms + 1; i++) { ev.AddCount(); Equal(initCount + i, ev.CurrentCount); } // Decrement until it hits 0. if (takeAllAtOnce) { ev.Signal(initCount + increms); } else { for (int i = 0; i < initCount + increms; i++) { False(ev.IsSet); ev.Signal(); } } True(ev.IsSet); Equal(0, ev.CurrentCount); // Now reset the event and check its count. ev.Reset(); Equal(ev.InitialCount, ev.CurrentCount); } }
/// <inheritdoc/> bool IAsyncEvent.Reset() => countdown.Reset();