public void CancelButtonShouldntEndUpSettingModel() { (new TestScheduler()).With(sched => { var fixture = new BlockTimerViewModel(new BlockItem() { Description = "Test Item" }); BlockTimerViewState lastState = BlockTimerViewState.Initialized; fixture.TimerState.Subscribe(x => lastState = x); fixture.Start.Execute(null); sched.RunToMilliseconds(10); Assert.AreEqual(BlockTimerViewState.Started, lastState); // Run to 10 minutes in and hit Cancel sched.RunToMilliseconds(10 * 60 * 1000); fixture.Cancel.Execute(null); // Run way past the end sched.RunToMilliseconds(60 * 60 * 1000); Assert.AreEqual(BlockTimerViewState.ShouldCancel, lastState); Assert.IsFalse(fixture.Model.IsObjectValid()); }); }
bool isTimerCurrentlyRunning(BlockTimerViewState state) { return (state == BlockTimerViewState.Started || state == BlockTimerViewState.StartedInBreak); }
bool isTimerCurrentlyRunning(BlockTimerViewState state) { return(state == BlockTimerViewState.Started || state == BlockTimerViewState.StartedInBreak); }