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

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

            Assert.IsInstanceOfType(state.GetNextState(), typeof(ReadState));
        }
Exemple #2
0
        public void CommandLogStateReturnsTodoListState()
        {
            ILog      mockLog      = Substitute.For <ILog>();
            IConsole  mockConsole  = Substitute.For <IConsole>();
            ITodoList mockTodoList = Substitute.For <ITodoList>();

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

            state.Input = "t";

            state.Execute();

            Assert.IsInstanceOfType(state.GetNextState(), typeof(DisplayTodoListHeaderState));
        }
Exemple #3
0
        public void CommandLogStateDisplaysHelpOnQuestionMark()
        {
            ILog      mockLog      = Substitute.For <ILog>();
            IConsole  mockConsole  = Substitute.For <IConsole>();
            ITodoList mockTodoList = Substitute.For <ITodoList>();

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

            state.Input = "?";

            state.Execute();

            mockConsole.Received(0).OutputLine("Unrecognised command. Please enter one of the following commands");
            mockConsole.Received(2).OutputLine("Search log entries");
            mockConsole.Received(1).OutputLine("Search previous results");
            mockConsole.Received(1).OutputLine("Enter TODO list");
            mockConsole.Received(1).OutputLine("Display help");

            Assert.IsInstanceOfType(state.GetNextState(), typeof(ReadState));
        }