public void CommandTodoStateReturnsRemoveTodoItemState() { ILog mockLog = Substitute.For<ILog>(); IConsole mockConsole = Substitute.For<IConsole>(); ITodoList mockTodoList = Substitute.For<ITodoList>(); CommandTodoState state = new CommandTodoState(mockConsole, mockLog, mockTodoList); state.Input = "r"; state.Execute(); Assert.IsInstanceOfType(state.GetNextState(), typeof(RemoveTodoItemState)); }
public void CommandTodoStateHandlesUnknownCommandStrings() { ILog mockLog = Substitute.For<ILog>(); IConsole mockConsole = Substitute.For<IConsole>(); ITodoList mockTodoList = Substitute.For<ITodoList>(); CommandTodoState state = new CommandTodoState(mockConsole, mockLog, mockTodoList); state.Input = "UNKNOWN COMMAND"; state.Execute(); mockConsole.Received(1).OutputLine("Unrecognised command. Please enter one of the following commands"); mockConsole.Received(1).OutputLine("Remove todo list entry"); mockConsole.Received(1).OutputLine("Display help"); Assert.IsInstanceOfType(state.GetNextState(), typeof(ReadTodoState)); }