コード例 #1
0
        public void DisplayLogHeaderStateReturnsReadState()
        {
            IConsole mockConsole = Substitute.For<IConsole>();
            ILog mockLog = Substitute.For<ILog>();
            ITodoList mockTodoList = Substitute.For<ITodoList>();
            DisplayLogHeaderState state = new DisplayLogHeaderState(mockConsole, mockLog, mockTodoList);

            Assert.IsInstanceOfType(state.GetNextState(), typeof(ReadState));
        }
コード例 #2
0
        public void DisplayLogHeaderStateOutputsHeaderText()
        {
            IConsole mockConsole = Substitute.For<IConsole>();
            ILog mockLog = Substitute.For<ILog>();
            ITodoList mockTodoList = Substitute.For<ITodoList>();
            DisplayLogHeaderState state = new DisplayLogHeaderState(mockConsole, mockLog, mockTodoList);
            state.Execute();

            mockConsole.Received(1).Clear();
            mockConsole.Received().OutputLine(Arg.Any<String>());
        }
コード例 #3
0
        public void DisplayLogHeaderStateOutputsTodaysLogs()
        {
            LogEntry logEntry = new LogEntry("entry");
            List<LogEntry> logEntries = new List<LogEntry>() { logEntry };

            IConsole mockConsole = Substitute.For<IConsole>();
            ILog mockLog = Substitute.For<ILog>();
            mockLog.GetEntries().Returns(logEntries);

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

            mockConsole.Received(1).Output("> ");
            mockConsole.Received(1).OutputLine("entry");
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: o0Tasker0o/Logger
        static void Main(string[] args)
        {
            Console.SetWindowSize(Console.WindowWidth, 60);
            Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));

            Log log = new Log();
            TodoList todoList = new TodoList();
            LogConsole console = new LogConsole();

            State nextState = new DisplayLogHeaderState(console, log, todoList);

            while(null != nextState)
            {
                nextState.Execute();
                nextState = nextState.GetNextState();
            }
        }