public void TryEnter_returns_true_if_interval_is_awaited_after_last_insert() { var interval = Fixture.Create <TimeSpan>(); var spots = Fixture.Create <int>(); var sut = Fill(CreateSystemUnderTest(spots, interval)); // Wait longer than interval _testClock.AdvanceBy(interval + interval); Assert.That(sut.TryEnter(), Is.True); }
public void TryEnter_returns_true_if_interval_is_awaited_after_last_insert() { var minutes = Fixture.Create <int>(); var interval = TimeSpan.FromMinutes(minutes); var spots = Fixture.Create <int>(); var sut = CreateSystemUnderTest(spots, interval); Fill(sut); Assume.That(sut.CanEnter(), Is.False); // Wait longer than interval _testClock.AdvanceBy(interval + TimeSpan.FromTicks(1)); Assert.That(sut.TryEnter(), Is.True); }
public void TestClock_can_be_advanced_by_specified_time_interval([Frozen] DateTimeOffset pointInTime, TestClock sut, TimeSpan advanceBy) { sut.AdvanceBy(advanceBy); Assert.That(sut.UtcNow, Is.EqualTo(pointInTime.ToUniversalTime() + advanceBy)); }