Exemplo n.º 1
0
        public void UserInterface_OnDoorClosed_DisplaysLightOff()
        {
            _sut.OnDoorOpened(new object(), EventArgs.Empty);

            _light.ClearReceivedCalls();
            _sut.OnDoorClosed(new object(), EventArgs.Empty);

            _light.Received().TurnOff();
        }
Exemplo n.º 2
0
 public void StartCancelBtnPress_LightTurnOff_RecievedCall()
 {
     _door.Open();
     _door.Close();
     _powerBtn.Press();
     _timeBtn.Press();
     _startCancelBtn.Press();
     _fakeLight.ClearReceivedCalls(); // Clear for at "fjerne" at lyset også slukker når _door.Close() kaldes. Så der bare skal Recieved(1) og ikke 2 for når tiden er gået.
     _fakeTimer.Expired += Raise.Event();
     _fakeLight.Received(1).TurnOff();
 }
        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();
        }
Exemplo n.º 4
0
        public void StartCancelBtnPress_LightTurnOff_RecievedNoCall()
        {
            _door.Open();
            _door.Close();
            _powerBtn.Press();
            _timeBtn.Press();
            _startCancelBtn.Press();
            _fakeLight.ClearReceivedCalls();

            _door.Open();

            Thread.Sleep(61000);
            _fakeLight.Received(0).TurnOff();
        }