Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public void CommandTodoStateDisplaysHelpOnQuestionMark()
        {
            ILog      mockLog      = Substitute.For <ILog>();
            IConsole  mockConsole  = Substitute.For <IConsole>();
            ITodoList mockTodoList = Substitute.For <ITodoList>();

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

            state.Input = "?";

            state.Execute();

            mockConsole.Received(0).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));
        }