Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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>());
        }
Esempio n. 5
0
 public void SetCurrentStatus(Constants.TimerStatus status)
 {
     base.CurrentStatus = status;
 }