示例#1
0
        public void Timeout_RestartsTimer()
        {
            _fakeTimer.ClearReceivedCalls();
            // Act
            _fakeTimer.ExpiredEvent += Raise.EventWith(null, EventArgs.Empty);

            // Assert
            _fakeTimer.Received(1).StartWithSeconds(10);
        }
        public void Open_StateIsCooking_MyCookerStops()
        {
            StateHelper.SetState(_userInterface, "Cooking");
            _output.ClearReceivedCalls();
            _timer.ClearReceivedCalls();

            _door.Open();
            _timer.Received(1).Stop();
        }
示例#3
0
 public void DoorOpen_TimerStop_RecievedCall()
 {
     _door.Open();
     _door.Close();
     _powerBtn.Press();
     _timeBtn.Press();
     _startCancelBtn.Press();
     _fakeTimer.ClearReceivedCalls();
     _door.Open();
     _fakeTimer.Received(1).Stop();
 }
示例#4
0
        public void Open_SetCookingState_MyCookerStops()
        {
            _userInterface.OnPowerPressed(null, EventArgs.Empty);
            _userInterface.OnTimePressed(null, EventArgs.Empty);
            _userInterface.OnStartCancelPressed(null, EventArgs.Empty);
            _output.ClearReceivedCalls();
            _timer.ClearReceivedCalls();

            _userInterface.OnDoorOpened(null, EventArgs.Empty);
            _timer.Received(1).Stop();
        }
示例#5
0
            public async Task StopShouldStopTheWorkerThread(
                [Substitute] IClientWebSocket clientWebSocket,
                [Frozen, Substitute] IGatewayService gateway,
                [Frozen, Substitute] ITimer timer,
                [Target] DefaultGatewayTxWorker txWorker
                )
            {
                await txWorker.Start(gateway, clientWebSocket);

                timer.ClearReceivedCalls();
                await txWorker.Stop();

                await timer.Received().Stop();
            }