Created
February 28, 2011 01:24
-
-
Save anaisbetts/846793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestMethod] | |
| public void TimerShouldFinishAfterThirtyMinutes() | |
| { | |
| (new TestScheduler()).With(sched => { | |
| var lastState = BlockTimerViewState.Initialized; | |
| bool isTimerStateDone = false; | |
| var fixture = new BlockTimerViewModel(new BlockItem() { | |
| Description = "Test Item" | |
| }); | |
| // Watch the Pomodoro timer state | |
| fixture.TimerState.Subscribe( | |
| state => lastState = state, | |
| () => isTimerStateDone = true); | |
| // Click the Start button | |
| fixture.Start.Execute(null); | |
| // Fast forward to 24 minutes in, the timer should *not* be done | |
| sched.RunToMilliseconds(24 * 60 * 1000); | |
| Assert.IsFalse(isTimerStateDone); | |
| // Let's go to 35 minutes | |
| sched.RunToMilliseconds(35 * 60 * 1000); | |
| // Make sure our model duration took 30 minutes(ish) | |
| TimeSpan pomodoroLength = | |
| (fixture.Model.EndedAt.Value - fixture.Model.StartedAt.Value); | |
| pomodoroLength.TotalMinutes.AssertWithinEpsilonOf(30.0); | |
| Assert.IsTrue(isTimerStateDone); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment