예제 #1
0
        public void CommandTodoStateReturnsReadTodoState()
        {
            ILog mockLog = Substitute.For<ILog>();
            IConsole mockConsole = Substitute.For<IConsole>();
            ITodoList mockTodoList = Substitute.For<ITodoList>();

            CommandTodoState state = new CommandTodoState(mockConsole, mockLog, mockTodoList);

            Assert.IsInstanceOfType(state.GetNextState(), typeof(ReadTodoState));
        }
예제 #2
0
        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));
        }