public void TimerShouldBeRestartable() { CountdownTimer subject = new TestCountdownTimer(new Milliseconds(500), new Milliseconds(100)); CountdownEvent latch = new CountdownEvent(5); subject.TimerEvent += (time, more) => latch.Signal(); subject.Start(); latch.Wait(700).Should().BeTrue(); latch = new CountdownEvent(5); subject.Start(); latch.Wait(700).Should().BeTrue(); }
public void Start_ShouldInvokeTimerBookEnd() { //Arrange //Arrange MockCountdownTimerElapsedAction mockCountdownTimerElapsedAction = new MockCountdownTimerElapsedAction.Builder().Build(); MockTimerBookEnd mockTimerBookEnd = new MockTimerBookEnd.Builder().Start().Build(); MockCountdownTracker mockCountdownTracker = new MockCountdownTracker.Builder().Restart().Build(); CountdownTimer subject = new TestCountdownTimer(mockCountdownTimerElapsedAction, mockTimerBookEnd, mockCountdownTracker); //Act subject.Start(); //Assert mockCountdownTracker.AssertRestartInvoked(); mockTimerBookEnd.AssertStartInvoked(); }