コード例 #1
0
        public void OnTimerExpired_CookingIsDone_LightDisplatNotCalled(int time)
        {
            // This tests that uut is calling CookingIsDone in the UI
            // and the UI calls clear on the display and turns off the light
            // simulating the event through NSubstitute
            _powerButton.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _timeButton.Pressed        += Raise.EventWith(this, EventArgs.Empty);
            _startCancelButton.Pressed += Raise.EventWith(this, EventArgs.Empty);

            _uut.StartCooking(50, time);
            _uut.Stop();


            // Receives 1 clear in UI OnStartCancelPressed state = SETTIME
            _displayUI.Received(1).Clear();
            _light.DidNotReceive().TurnOff();
        }
コード例 #2
0
        public void LightOnWhenDoorOpened()
        {
            // Check that light received TurnOn.
            door.Open();
            light.Received(1).TurnOn();
            light.ClearReceivedCalls();

            // Check that light is neither turned on or off when door is open.
            door.Open();
            light.DidNotReceive().TurnOn();
            light.DidNotReceive().TurnOff();

            // Close the door.
            door.Close();
            light.Received(1).TurnOff();
            light.ClearReceivedCalls();

            // Try and re-close the door.
            door.Close();
            light.DidNotReceive().TurnOff();
            light.DidNotReceive().TurnOn();
        }
コード例 #3
0
        public void Doorclosed_StateReady_ExpectedResultNoCall()
        {
            door.Close();

            light.DidNotReceive().TurnOff();
        }
コード例 #4
0
 public void UserInterface_Door_CloseClosedDoor()
 {
     Door.Close();
     Light.DidNotReceive().TurnOff();
 }
コード例 #5
0
 public void ButtonStartCancelUserInterface_Press0()
 {
     _powerButton.Press();
     _light.DidNotReceive().TurnOff();
     _display.DidNotReceive().Clear();
 }