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; } } }
private static void Main(string[] args) { var light = new Light(); var heater = new Heater(); var startButton = new StartButton(); var door = new Door(); var timer = new MicrowaveTimer(); var microwave = new MicrowaveOvenHw(door, light, heater, startButton, timer); RunCommandLoop(microwave); }
public void Setup() { doorMock = new Mock <IDoor>(); doorMock.SetupGet(m => m.IsDoorOpen).Returns(false); lightMock = new Mock <ILight>(); lightMock.SetupGet(m => m.IsIsLightOn).Returns(false); heaterMock = new Mock <IHeater>(); heaterMock.SetupGet(m => m.IsHeaterOn).Returns(false); startButtonMock = new Mock <IStartButton>(); startButtonMock.SetupGet(m => m.IsStartButtonPressed).Returns(false); timerMock = new Mock <ITimer>(); microwaveOvenHw = new MicrowaveOvenHw(doorMock.Object, lightMock.Object, heaterMock.Object, startButtonMock.Object, timerMock.Object); }