public void AddEntry(TodoEntry entry) { using (LoggerDbContext loggerDatabase = new LoggerDbContext()) { loggerDatabase.TodoEntries.Add(entry); loggerDatabase.SaveChanges(); } }
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"); }
public void TodoEntryThrowsExceptionWhenGivenNullText() { TodoEntry entry = new TodoEntry(null); }
public void TodoEntryThrowsExceptionWhenGivenEmptyText() { TodoEntry entry = new TodoEntry(""); }