Пример #1
0
 public void AddEntry(TodoEntry entry)
 {
     using (LoggerDbContext loggerDatabase = new LoggerDbContext())
     {
         loggerDatabase.TodoEntries.Add(entry);
         loggerDatabase.SaveChanges();
     }
 }
Пример #2
0
 public void AddEntry(TodoEntry entry)
 {
     using (LoggerDbContext loggerDatabase = new LoggerDbContext())
     {
         loggerDatabase.TodoEntries.Add(entry);
         loggerDatabase.SaveChanges();
     }
 }
Пример #3
0
        public void TodoEntryStoresInputText()
        {
            const string cEntryText = "This is a log entry";

            TodoEntry entry = new TodoEntry(cEntryText);

            Assert.AreEqual(cEntryText, entry.Text);
        }
        public void DisplayTodoHeaderStateOutputsAllTodoItems()
        {
            TodoEntry todoEntry = new TodoEntry("entry");
            List<TodoEntry> todoEntries = new List<TodoEntry>() { todoEntry };

            IConsole mockConsole = Substitute.For<IConsole>();
            ILog mockLog = Substitute.For<ILog>();
            ITodoList mockTodoList = Substitute.For<ITodoList>();
            mockTodoList.GetEntries().Returns(todoEntries);

            DisplayTodoListHeaderState state = new DisplayTodoListHeaderState(mockConsole, mockLog, mockTodoList);
            state.Execute();

            mockConsole.Received(1).Output("0> ");
            mockConsole.Received(1).OutputLine("entry");
        }
Пример #5
0
 public void TodoEntryThrowsExceptionWhenGivenNullText()
 {
     TodoEntry entry = new TodoEntry(null);
 }
Пример #6
0
 public void TodoEntryThrowsExceptionWhenGivenEmptyText()
 {
     TodoEntry entry = new TodoEntry("");
 }