public void Input_WhenCalled_CallsReaderOnce() { //Arrange var reader = new Mock <IReader>(); var writer = new Mock <IWriter>(); reader.Setup(x => x.ReadLine()).Returns("2"); var commandFactory = new Mock <ICommandFactory>(); var menu = new FakeMenu(reader.Object, writer.Object, commandFactory.Object); //Act menu.Input(); //Assert reader.Verify(x => x.ReadLine(), Times.Once()); }
public void Input_ReadInvalidValue_CallsWriteOnce() { //Arrange var reader = new Mock <IReader>(); var writer = new Mock <IWriter>(); reader.Setup(x => x.ReadLine()).Returns("e"); var commandFactory = new Mock <ICommandFactory>(); var menu = new FakeMenu(reader.Object, writer.Object, commandFactory.Object); //Act menu.Input(); //Assert writer.Verify(x => x.WriteLine("Incorect input value"), Times.Once()); }