Ejemplo n.º 1
0
        public void ReadTodoStateReturnsDisplayLogHeaderStateStateWhenReadingBlankString()
        {
            IConsole      mockConsole  = Substitute.For <IConsole>();
            ILog          mockLog      = Substitute.For <ILog>();
            ITodoList     mockTodoList = Substitute.For <ITodoList>();
            ReadTodoState state        = new ReadTodoState(mockConsole, mockLog, mockTodoList);

            state.Execute();

            Assert.IsInstanceOfType(state.GetNextState(), typeof(DisplayLogHeaderState));
        }
Ejemplo n.º 2
0
        public void ReadTodoStateReadsConsoleWhenExecuted()
        {
            IConsole      mockConsole  = Substitute.For <IConsole>();
            ILog          mockLog      = Substitute.For <ILog>();
            ITodoList     mockTodoList = Substitute.For <ITodoList>();
            ReadTodoState state        = new ReadTodoState(mockConsole, mockLog, mockTodoList);

            state.Execute();

            mockConsole.Received(1).GetInput();
        }
Ejemplo n.º 3
0
        public void ReadTodoStateOutputsPromptCharacter()
        {
            IConsole      mockConsole  = Substitute.For <IConsole>();
            ILog          mockLog      = Substitute.For <ILog>();
            ITodoList     mockTodoList = Substitute.For <ITodoList>();
            ReadTodoState state        = new ReadTodoState(mockConsole, mockLog, mockTodoList);

            state.Execute();

            mockConsole.Received(1).Output(">");
        }
Ejemplo n.º 4
0
        public void ReadTodoStateReturnsCommandStateWhenReadingCommand()
        {
            IConsole mockConsole = Substitute.For <IConsole>();

            mockConsole.GetInput().Returns(">COMMANDSTRING");

            ILog          mockLog      = Substitute.For <ILog>();
            ITodoList     mockTodoList = Substitute.For <ITodoList>();
            ReadTodoState state        = new ReadTodoState(mockConsole, mockLog, mockTodoList);

            state.Execute();

            State nextState = state.GetNextState();

            Assert.IsInstanceOfType(nextState, typeof(CommandTodoState));
            Assert.AreEqual("COMMANDSTRING", nextState.Input);
        }
Ejemplo n.º 5
0
        public void ReadTodoStateReturnsStoreStateWhenReadingPlainText()
        {
            const string cConsoleInput = "This is plain text";
            IConsole     mockConsole   = Substitute.For <IConsole>();

            mockConsole.GetInput().Returns(cConsoleInput);

            ILog          mockLog      = Substitute.For <ILog>();
            ITodoList     mockTodoList = Substitute.For <ITodoList>();
            ReadTodoState state        = new ReadTodoState(mockConsole, mockLog, mockTodoList);

            state.Execute();

            State nextState = state.GetNextState();

            Assert.IsInstanceOfType(nextState, typeof(StoreTodoState));
            Assert.AreEqual(cConsoleInput, nextState.Input);
        }