public void UICookingIsDone_LightTurnOff()
 {
     _uut.OnPowerPressed(_pButton, EventArgs.Empty);
     _uut.OnTimePressed(_tButton, EventArgs.Empty);
     _uut.OnStartCancelPressed(_scButton, EventArgs.Empty);
     _uut.CookingIsDone();
     _light.Received().TurnOff();
 }
Example #2
0
 public void CookingDone_LightIsOff_OutputIsCorrect()
 {
     _powerButton.Press();
     _timerButton.Press();
     _startcancelButton.Press();
     _userinterface.CookingIsDone();
     _output.Received(1).OutputLine("Light is turned off");
 }
        public void UI_Light_CookingIsDone_TurnOffLight()
        {
            _powerButton.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _timeButton.Pressed        += Raise.EventWith(this, EventArgs.Empty);
            _startCancelButton.Pressed += Raise.EventWith(this, EventArgs.Empty);

            _uut.CookingIsDone();
            _output.Received(1).OutputLine("Light is turned off");
        }
Example #4
0
        public void Test_Turn_Off_Light_CookingIsDone()
        {
            _powerButton.Press();
            _timeButton.Press();
            _startCancelButton.Press();

            _userInterface.CookingIsDone();

            Assert.That(stringWriter.ToString(), Does.Contain("Light is turned off"));
        }
        public void Test_TurnOffLightCalled_onCookingIsDone()
        {
            _powerButton.Press();
            _timeButton.Press();
            _startCancelButton.Press();     //Starter cooking

            _userInterface.CookingIsDone(); //Afslutter cooking

            Assert.That(stringwriter.ToString(), Does.Contain("Light is turned off"));
        }
Example #6
0
        public void CookingIsDone_StateCooking_ExpectedResult_DisplayCleared()
        {
            powerButton.Press();
            timeButton.Press();

            startCancelButton.Press();
            UI.CookingIsDone();

            display.Received(1).Clear();
        }
Example #7
0
        public void TestUserInterface_DisplayClear_CorrectOutput()
        {
            Console.SetOut(_stringWriter);
            _door.Opened         += Raise.EventWith(this, EventArgs.Empty);
            _door.Closed         += Raise.EventWith(this, EventArgs.Empty);
            _buttonPower.Pressed += Raise.EventWith(this, EventArgs.Empty);

            // Now in SetPower
            _timeButton.Pressed += Raise.EventWith(this, EventArgs.Empty);
            // Now in SetTime
            _startButton.Pressed += Raise.EventWith(this, EventArgs.Empty);

            _sut.CookingIsDone();

            Assert.That(_stringWriter.ToString().Contains("Display cleared"));
        }
 public void CookingIsDone_TurnOnTurnOffTurnOnTurnOff_LightIsOff()
 {
     _ui.OnDoorOpened(_door, EventArgs.Empty);
     _ui.OnDoorClosed(_door, EventArgs.Empty);
     _ui.OnStartCancelPressed(_startButton, EventArgs.Empty);
     _ui.CookingIsDone();
     _output.Received().OutputLine(Arg.Is <string>(str => str.Contains("off")));
 }
Example #9
0
        public void CookingIsDone_WhenCookingIsDone_DisplayIsCleared()
        {
            _powerButton.Press();
            _startCancelButton.Press();
            _userInterface.CookingIsDone();

            _fakeOutput.Received(1).OutputLine("Display cleared");
        }
 public void OnStartCancelPressed_TimesRunOut_DisplayCleared()
 {
     _ui.OnPowerPressed(_powerButton, EventArgs.Empty);
     _ui.OnTimePressed(_timeButton, EventArgs.Empty);
     _ui.OnStartCancelPressed(_startButton, EventArgs.Empty);
     _ui.CookingIsDone();
     _output.Received(1).OutputLine(Arg.Is <string>(str => str.Contains("Display cleared")));
 }
Example #11
0
        public void CookingIsDone_StateCooking()
        {
            userInterface.OnPowerPressed(new object(), EventArgs.Empty);       //Set state to SetPower
            userInterface.OnTimePressed(new object(), EventArgs.Empty);        //Set state to SetTime

            userInterface.OnStartCancelPressed(new object(), EventArgs.Empty); //SetState Cooking
            userInterface.CookingIsDone();
        }
Example #12
0
 public void Light_Done_IsOff()
 {
     PowerButton.Press();
     TimeButton.Press();
     startCancel.Press();
     //after a while cooking is done (timer stub)
     UserInterface.CookingIsDone();
     output.Received(1).OutputLine(Arg.Is <string>(x => x.Contains("off")));
 }
        public void Cooking_CookingIsDone_ClearDisplay()
        {
            _powerButton.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _timeButton.Pressed        += Raise.EventWith(this, EventArgs.Empty);
            _startCancelButton.Pressed += Raise.EventWith(this, EventArgs.Empty);

            _tlm.CookingIsDone();
            _output.Received(1).OutputLine(Arg.Is <string>("Display cleared"));
        }
Example #14
0
        public void Display_CookingisDone_Clear_Test()
        {
            _powerButton.Press();
            _timeButton.Press();
            _startCancelButton.Press();
            _userInterface.CookingIsDone();

            _output.Received(1).OutputLine(Arg.Is <string>(str => str.Contains("Display cleared")));
        }
        public void Cooking_CookingIsDone_ClearDisplay()
        {
            _tlmPowerButton.Press();
            _tlmTimeButton.Press();
            _tlmStartCancelButton.Press();

            _userInterface.CookingIsDone();
            _output.Received(1).OutputLine(Arg.Is <string>("Display cleared"));
        }
        public void CookingIsDoneCalled_DisplayCleared()
        {
            _powerBtn.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _timerBtn.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _startCancelBtn.Pressed += Raise.EventWith(this, EventArgs.Empty);
            _uut.CookingIsDone();

            //Is received twice because the startCancelBtn.Pressed event calls display.clear, and the CookingIsDone calls display.clear
            _output.Received(2).OutputLine(Arg.Is <string>(str => str.Contains($"Display cleared")));
        }
Example #17
0
        public void LightOff_when_DoneCooking()
        {
            _powerButton.Pressed         += Raise.Event();
            _timeButton.Pressed          += Raise.Event();
            _start_cancel_button.Pressed += Raise.Event();

            _uut.CookingIsDone();

            _output.Received(1).OutputLine("Light is turned off");
        }
        public void UserInterface_ClearAndTurnoff_WhenCookingIsDone()
        {
            _powerbutton.Pressed       += Raise.Event();
            _timebutton.Pressed        += Raise.Event();
            _startcancelbutton.Pressed += Raise.Event();

            _uut.CookingIsDone();

            _display.Received().Clear();
            _light.Received().TurnOff();
        }
Example #19
0
        public void CookingIsDone_WhenCookingIsDone_LightIsOff()
        {
            // act
            _powerButton.Press();
            _timeButton.Press();
            _starCancelButton.Press();
            _userInterface.CookingIsDone();

            // Assert
            _fakeOutput.Received(1).OutputLine("Light is turned off");
        }
        public void Display_Cleared_CookingIsDone_OutputIsCorrect()
        {
            _userInterface.OnPowerPressed(_powerButton, EventArgs.Empty);
            _userInterface.OnTimePressed(_timeButton, EventArgs.Empty);
            _userInterface.OnStartCancelPressed(_startCancelButton, EventArgs.Empty);
            _output.ClearReceivedCalls();

            _userInterface.CookingIsDone();

            _output.Received().OutputLine("Display cleared");
        }
Example #21
0
        public void Cooking_CookingIsDone_ClearDisplay_LightOff()
        {
            _powerButton.Press();
            _timerButton.Press();
            _startCancelButton.Press();

            _ui.CookingIsDone();

            _fakeDisplay.Received(1).Clear();
            _fakeLight.Received(1).TurnOff();
        }
Example #22
0
 public void cookingIsDone()
 {
     //test 10 sætter indstillinger
     IPowerButton.Press();
     ITimeButton.Press();
     //tænder for maskinen
     ICancelButton.Press();
     //test cooking is done på en eller anden måde???
     userInterface.CookingIsDone();
     ILight.Received().TurnOff();
 }
 public void CookingIsDone_StateCooking_CorrectTextIsDisplayed()
 {
     _door.Opened               += Raise.EventWith(this, EventArgs.Empty);
     _door.Closed               += Raise.EventWith(this, EventArgs.Empty);
     _powerButton.Pressed       += Raise.EventWith(this, EventArgs.Empty);
     _timerButton.Pressed       += Raise.EventWith(this, EventArgs.Empty);
     _startCancelButton.Pressed += Raise.EventWith(this, EventArgs.Empty);
     _sut.CookingIsDone();
     _output.Received(1).OutputLine(Arg.Is <string>(s => s.Contains("cleared")));
     _output.Received(2).OutputLine(Arg.Is <string>(s => s.Contains("off")));
 }
Example #24
0
 public void CoocingController_CookingIsDone_DisplayClear()
 {
     door.Opened              += Raise.EventWith(this, EventArgs.Empty);
     door.Closed              += Raise.EventWith(this, EventArgs.Empty);
     buttoPower.Pressed       += Raise.EventWith(this, EventArgs.Empty);
     buttoTime.Pressed        += Raise.EventWith(this, EventArgs.Empty);
     buttoStartCancel.Pressed += Raise.EventWith(this, EventArgs.Empty);
     userInterface.CookingIsDone();
     fakeOutput.Received(1).OutputLine(Arg.Is <string>(s => s.Contains("Display cleared")));
     // "Light is turned of"
     fakeOutput.Received(2).OutputLine(Arg.Is <string>(s => s.Contains("Light") && s.Contains("off")));
 }
Example #25
0
        public void Cooking_CookingIsDone_LightOff()
        {
            powerButton.Pressed += Raise.EventWith(this, EventArgs.Empty);
            // Now in SetPower
            timeButton.Pressed += Raise.EventWith(this, EventArgs.Empty);
            // Now in SetTime
            startCancelButton.Pressed += Raise.EventWith(this, EventArgs.Empty);
            // Now in cooking

            sut.CookingIsDone();
            Assert.That(stringWriter.ToString().Contains("Light is turned off"));
        }
Example #26
0
        public void CookingIsDone_Cooking_CorrectOutput()
        {
            //Arrange
            _powerbutton.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _timeButton.Pressed        += Raise.EventWith(this, EventArgs.Empty);
            _startCancelButton.Pressed += Raise.EventWith(this, EventArgs.Empty);

            //Act
            _userInterface.CookingIsDone();

            //Assert
            _output.Received(1).OutputLine(Arg.Is <string>(str => str.Contains("Light is turned off")));
        }
        public void CookingIsDoneCalled_LightTurnOff()
        {
            //Setting the state
            _powerBtn.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _timerBtn.Pressed       += Raise.EventWith(this, EventArgs.Empty);
            _startCancelBtn.Pressed += Raise.EventWith(this, EventArgs.Empty);

            //Trigger the event
            _uut.CookingIsDone();

            //Check if the light gets turned on
            _output.Received(1).OutputLine(Arg.Is <string>(str => str.Contains(("Light is turned off"))));
        }
Example #28
0
        public void CookingIsDone_TurnedOff()
        {
            input.OnPowerPressed(powerButton, EventArgs.Empty);
            input.OnTimePressed(timeButton, EventArgs.Empty);
            input.OnStartCancelPressed(startCancelButton, EventArgs.Empty);
            input.CookingIsDone();

            output.Received().OutputLine(Arg.Is <string>(str => str.Contains("50 W")));
            output.Received().OutputLine(Arg.Is <string>(str => str.Contains("01:00")));
            output.Received().OutputLine(Arg.Is <string>(str => str.Contains("cleared")));
            output.Received().OutputLine(Arg.Is <string>(str => str.Contains("on")));
            output.Received().OutputLine(Arg.Is <string>(str => str.Contains("50 W")));
            output.Received().OutputLine(Arg.Is <string>(str => str.Contains("off")));
        }
 public void StateCooking_CookingIsDone_TurnOff()
 {
     //state ready
     _door.Opened += Raise.EventWith(this, EventArgs.Empty);
     _door.Closed += Raise.EventWith(this, EventArgs.Empty);
     //Steate opend closed --> ready
     _power.Pressed += Raise.EventWith(this, EventArgs.Empty);
     //set power
     _time.Pressed += Raise.EventWith(this, EventArgs.Empty);
     //State set time
     _start.Pressed += Raise.EventWith(this, EventArgs.Empty);
     _ui.CookingIsDone();
     _iOutput.Received().OutputLine("Light is turned off");
 }
        public void CookingIsDone_StateIsCOOKING_OutputShowsDisplayClearAndLightOff()
        {
            // Arrange:
            _tlm.OnPowerPressed(new object(), new EventArgs());       //--> state = State.SETPOWER
            _tlm.OnTimePressed(new object(), new EventArgs());        //--> state = State.SETTIME
            _tlm.OnStartCancelPressed(new object(), new EventArgs()); //--> state = State.COOKING
            _output.ClearReceivedCalls();                             // Clear output

            // Act:
            _tlm.CookingIsDone();

            // Assert:
            _output.Received().OutputLine(Arg.Is <string>(str =>
                                                          str.ToLower().Contains("display") &&
                                                          str.ToLower().Contains("clear")));
        }