public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = TimeSpan.FromMinutes(1); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking(powerLevel, time); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = TimeSpan.FromMinutes(1); myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnDoorOpened(object sender, EventArgs e) { switch (myState) { case States.READY: myLight.TurnOn(); myState = States.DOOROPEN; break; case States.SETPOWER: powerLevel = 50; myLight.TurnOn(); myDisplay.Clear(); myState = States.DOOROPEN; break; case States.SETTIME: powerLevel = 50; time = 1; myLight.TurnOn(); myDisplay.Clear(); myState = States.DOOROPEN; break; case States.COOKING: myCooker.Stop(); powerLevel = 50; time = 1; myState = States.DOOROPEN; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: ResetValues(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myLight.TurnOn(); myCooker.StartCooking(powerLevel, time * 60); myState = States.COOKING; break; case States.COOKING: ResetValues(); myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking(Convert.ToInt32(Math.Round(Convert.ToDouble(powerLevel) / 7)), time * 60000); //rettelse myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: ResetValues(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myLight.TurnOn(); myCooker.StartCooking(powerLevel, time * 60); myState = States.COOKING; break; case States.COOKING: ResetValues(); myCooker.Stop(); myLight.TurnOff(); //Vi indsætter nedenfor TurnOn da der skal være lys i microen når man starter den //myLight.TurnOn(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking(powerLevel, time * 60); //Tid skal være seconds konsekvent over det hele. myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); // Calculate powerLevel to percent int powerPercentLevel = (700 - powerLevel) * 100 / 700; powerPercentLevel = 100 - powerPercentLevel; myCooker.StartCooking(powerPercentLevel, time * 60); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: /*myDisplay.Clear();*/ //Fejl ifølge sekvensdiagram og UC myLight.TurnOn(); myCooker.StartCooking(powerLevel, time * 60); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void TestLight_TurnOn_CorrectOutput() { Console.SetOut(_stringWriter); _light.TurnOn(); Assert.That(_stringWriter.ToString().Contains("on") && _stringWriter.ToString().Contains("Light")); }
public void TurnOnIsCalledOnce() { _sut.TurnOn(); _sut.TurnOn(); _outputSub.ReceivedWithAnyArgs(1).OutputLine(""); }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); // er ikke på SQD eller STM myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking(powerLevel, time * 60); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking((int)powerPercent, time * 1000 * 60); //Rettet til at sende PowerPercentage med. myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: ResetValues(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myLight.TurnOn(); // Added *1000 to turn the time variable into miliseconds, as the timer component works with that precision. myCooker.StartCooking(powerLevel, time * 60 * 1000); myState = States.COOKING; break; case States.COOKING: ResetValues(); myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; // I think this is a mistake, since on the STM // It doesnt say anything about a light // // it also fails with the integration test //myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking((powerLevel / 7), time * 60); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: //Hvorfor clearer den her? Det står ikke i sekvensdiagrammet myDisplay.Clear(); myLight.TurnOn(); myCooker.StartCooking(powerLevel, time * 60); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: //Removed Display.Clear(), not in diagrams //myDisplay.Clear(); myLight.TurnOn(); //Divide powerlevel with 7 to get procentage myCooker.StartCooking(powerLevel / 7, time * 60); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: //myDisplay.Clear(); It shouldn't clear Display according to UC myLight.TurnOn(); myCooker.StartCooking(powerLevel, (time * 60) * 1000); myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void OnStartCancelPressed(object sender, EventArgs e) { switch (myState) { case States.SETPOWER: powerLevel = 50; time = 1; myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; case States.SETTIME: //myDisplay.Clear(); Slettet linje per UC definition myLight.TurnOn(); myCooker.StartCooking(powerLevel, (time * 60) * 1000); //Sender sekunder, forventer millisekunder dette er rettet myState = States.COOKING; break; case States.COOKING: powerLevel = 50; time = 1; myCooker.Stop(); myLight.TurnOff(); myDisplay.Clear(); myState = States.READY; break; } }
public void TurnOn_IsOnIsFalse_OutputIsCalledCorrectly() { // Act: _lmt.TurnOn(); // Assert: Assert.That(textWriter.ToString(), Contains.Substring("on")); }
public void TurnOn_LightIsTurnedOnIsWritten() { _sut.TurnOn(); var text = _readConsole.ToString(); Assert.That(text, Is.EqualTo("Light is turned on\r\n")); }
public void TurnOn_Called_OutputCorrect() { _light.TurnOn(); string expected = $"Light is turned on{Environment.NewLine}"; Assert.AreEqual(expected, _sw.ToString()); }
public void TestLight_OutputTurnOn() { Console.SetOut(_writer); _light.TurnOn(); string ConsoleOutput = _writer.ToString(); Assert.That(ConsoleOutput, Is.EqualTo($"Light is turned on\r\n")); }
public void TurnOn_WasOff_CorrectOutput() { using (StringWriter sw = new StringWriter()) { Console.SetOut(sw); _light.TurnOn(); string expected = $"Light is turned on{Environment.NewLine}"; Assert.AreEqual(expected, sw.ToString()); } }
public void LightOn_OutputTest() { string Log; StringWriter stringWriter = new StringWriter(); Console.SetOut(stringWriter); _sut.TurnOn(); Log = stringWriter.ToString(); Assert.That(Log, Is.EqualTo("Light is turned on\r\n")); }
public void LightOnOutputLightOnTest() { string console; StringWriter stringWriter = new StringWriter(); Console.SetOut(stringWriter); _sut.TurnOn(); console = stringWriter.ToString(); Assert.That(console, Is.EqualTo("Light is turned on\r\n")); }
public void DoorOpenedThenClosed_UITurnsLightOnOff() { _uut.Open(); _uut.Close(); Received.InOrder(() => { _light.TurnOn(); _light.TurnOff(); }); }
public void TurnOn_WasOff_ExpectedOutputInConsole_LightIsTurnedOn() { StringWriter stringWriter = new StringWriter(); Console.SetOut(stringWriter); light.TurnOn(); Assert.That(stringWriter.ToString().ToLower().Contains("on") && stringWriter.ToString().ToLower().Contains("light")); }
public void OnStartCancelPressed_MyStateIsSetPower_LightGetsTurnedOff() { //Arrange _userInterface.OnPowerPressed(_powerButton, EventArgs.Empty); _light.TurnOn(); //Act _userInterface.OnStartCancelPressed(_startCancelButton, EventArgs.Empty); //Assert _output.Received().OutputLine(Arg.Is <string>(str => str.Contains("off"))); }
public void StartCancelButton_Press_TurnOn_StartCooking() { //Act _powerButton.Press(); _timeButton.Press(); _startCancelButton.Press(); //Assert Assert.Multiple(() => { _light.TurnOn(); _cookController.Received(1).StartCooking(50, 1 * 60); }); }
static void Main(string[] args) { ICreator creator = new BulbCreator(); ILight light = creator.Factory(); light.TurnOn(); light.TurnOff(); creator = new TubeCreator(); light = creator.Factory(); light.TurnOn(); light.TurnOff(); Console.ReadKey(); }