private static void RunCommandLoop(MicrowaveOvenHw microwave) { while (true) { PrintMenu(); var commandNumer = 0; var result = Console.ReadLine(); if (int.TryParse(result, out commandNumer)) { switch (commandNumer) { case 1: microwave.OpenDoor(); break; case 2: microwave.CloseDoor(); break; case 3: microwave.TurnOnHeater(); break; } } else { break; } } }
public void WhenButtonIsPressedAndDoorIsOpenTheanHeaterIsNotStarted() { doorMock.SetupGet(m => m.IsDoorOpen).Returns(true); microwaveOvenHw.TurnOnHeater(); heaterMock.Verify(m => m.TurnOn(), Times.Never); }