public void TurnOff_OutputCorrect() { _sut.TurnOn(); _sut.TurnOff(); StringAssert.IsMatch("Light is turned off", _stringWriter.ToString()); }
public void TurnOff_WasOn_CorrectOutput() { _light.TurnOn(); _output.ClearReceivedCalls(); _light.TurnOff(); _output.Received().OutputLine(Arg.Is <string>(str => str.Contains("off"))); }
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; // 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(); // 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(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: 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; 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: //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(); 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: 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 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 = 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 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: 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 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: 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 TurnOff_IsOnIsFalse_NothingHappened() { // Act: _lmt.TurnOff(); // Assert: Assert.That(textWriter.ToString(), Is.EqualTo(string.Empty)); }
public void TurnOffIsCalledOnce() { _sut.TurnOn(); _sut.TurnOff(); _sut.TurnOff(); _outputSub.ReceivedWithAnyArgs(2).OutputLine(""); }
public void LightOffWhileOffOutputNothingTest() { string console; StringWriter stringWriter = new StringWriter(); Console.SetOut(stringWriter); _sut.TurnOff(); console = stringWriter.ToString(); Assert.That(console, Is.EqualTo("")); }
public void TurnOff_WasOn_CorrectOutput() { using (StringWriter sw = new StringWriter()) { Console.SetOut(sw); _light.TurnOn(); _light.TurnOff(); string expected = $"Light is turned on{Environment.NewLine}Light is turned off{Environment.NewLine}"; Assert.AreEqual(expected, sw.ToString()); } }
public void TurnOff_WasOn_ExpectedOutputInConsole_LightIsTurnedOff() { StringWriter stringWriter = new StringWriter(); Console.SetOut(stringWriter); light.TurnOn(); light.TurnOff(); Assert.That(stringWriter.ToString().ToLower().Contains("off") && stringWriter.ToString().ToLower().Contains("light")); }
public void LightOff_WhileLightOn_OutputTest() { _sut.TurnOn(); string Log; StringWriter stringWriter = new StringWriter(); Console.SetOut(stringWriter); _sut.TurnOff(); Log = stringWriter.ToString(); Assert.That(Log, Is.EqualTo("Light is turned off\r\n")); }
public void CookingIsDone() { switch (myState) { case States.COOKING: powerLevel = 50; time = 1; myDisplay.Clear(); myLight.TurnOff(); // Beep 3 times myState = States.READY; break; } }
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(); }
public void TurnOff_lightTurnsOff_MessageSentToConsole() { uut.TurnOn(); Console.SetOut(consoleOut); uut.TurnOff(); Assert.That(consoleOut.ToString().Equals("Light is turned off\r\n")); }
public void LightOutput_TurnOff() { _light.TurnOn(); _light.TurnOff(); _consoleOutput = stringWriter.ToString(); Assert.That(_consoleOutput.Contains("Light is turned off")); }
public void PowerTubeTurnOff_OutputLine() { _uut.TurnOn(); _uut.TurnOff(); _output.Received().OutputLine(Arg.Is <string>(str => str.Contains("Light is turned off"))); }
public void TestLight_TurnOff_CorrectOutput() { _light.TurnOn(); Console.SetOut(_stringWriter); _light.TurnOff(); Assert.That(_stringWriter.ToString().Contains("off") && _stringWriter.ToString().Contains("Light")); }
public void TurnOff_LightIsTurnedOffIsWritten() { _sut.TurnOn(); _sut.TurnOff(); var text = _readConsole.ToString(); Assert.That(text, Is.EqualTo("Light is turned on\r\nLight is turned off\r\n")); }