public void TimerClicked_TimerRunningOrPaused(Constants.TimerStatus statusBeforeClick, bool timerRunningAfterClick) { //Arrange _timeHelper.Object.SetCurrentStatus(statusBeforeClick); //Act _timeHelper.Object.TimerClicked(); //Assert Assert.AreEqual(_timeHelper.Object.IsTimerEnabled(), timerRunningAfterClick); }
public void TimerClicked_TimerStatusChangedCorrectly(Constants.TimerStatus before, Constants.TimerStatus expectedAfter) { //Arrange _timeHelper.Object.SetCurrentStatus(before); //Act _timeHelper.Object.TimerClicked(); //Assert Assert.AreEqual(_timeHelper.Object.CurrentStatus, expectedAfter); }
public void Reset_TimerStatusChangedToStopped(Constants.TimerStatus before) { //Arrange _timeHelper.Object.SetCurrentStatus(before); //Act _timeHelper.Object.Reset(); //Asser Assert.AreEqual(_timeHelper.Object.CurrentStatus, Constants.TimerStatus.STOPPED); }
public void TimerRunning_UpdateDisplayTimeCalled(Constants.TimerStatus statusBeforeClick) { //Arrange var timer = new DispatcherTimer(DispatcherPriority.Normal); timer.Interval = new TimeSpan(0, 0, 0, 0, 1); var timeHelper = new Mock <TimeHelper>(_timer) { CallBase = true }; timeHelper.Protected().Setup("UpdateTimeToDisplay", ItExpr.IsAny <object>(), ItExpr.IsAny <EventArgs>()).Verifiable(); //Act timeHelper.Object.TimerClicked(); Thread.Sleep(20); //Assert timeHelper.Protected().Verify("UpdateTimeToDisplay", Times.AtLeastOnce(), ItExpr.IsAny <object>(), ItExpr.IsAny <EventArgs>()); }
public void SetCurrentStatus(Constants.TimerStatus status) { base.CurrentStatus = status; }