public void TestDoubleMinValueCanAcquireExactlyOnce() { var stopwatch = new FakeStopwatch(); var r = RateLimiter.Create(stopwatch, Epsilon); Assert.IsTrue(r.TryAcquire(), "Unable to Acquire initial permit"); Assert.IsFalse(r.TryAcquire(), "Capable of acquiring an additional permit"); stopwatch.SleepMillis(int.MaxValue); Assert.IsFalse(r.TryAcquire(), "Capable of acquiring an additional permit after sleeping"); stopwatch.ReadEventsAndClear(); }
private void AssertEvents(FakeStopwatch stopwatch, params string[] events) { Assert.AreEqual(string.Join(", ", events), stopwatch.ReadEventsAndClear()); }