public void AddTaskToTodoListTest() { var repo = new TodoRepository(); var todoList = new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }; var result = repo.AddTodoList(todoList); Assert.IsTrue(result); var todoTask = new TodoTask { Id = Guid.NewGuid().ToString(), Name = "Task name", Completed = false }; result = repo.AddTaskToTodoList(todoList.Id, todoTask); Assert.IsTrue(result); var repList = repo.FindTodoList(todoList.Id); Assert.IsNotNull(repList); var repTask = repList.Tasks.First(); Assert.AreEqual(todoTask.Id, repTask.Id); Assert.AreEqual(todoTask.Name, repTask.Name); Assert.AreEqual(todoTask.Completed, repTask.Completed); }
public void CompleteTaskWithWrongTodoTaskIdTest() { var repo = new TodoRepository(); var todoList = new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }; repo.AddTodoList(todoList); var todoTask = new TodoTask { Id = Guid.NewGuid().ToString(), Name = "Task name", Completed = false }; repo.AddTaskToTodoList(todoList.Id, todoTask); var result = repo.CompleteTask(todoList.Id, "1", true); Assert.IsFalse(result); var repList = repo.FindTodoList(todoList.Id); Assert.IsNotNull(repList); var repTask = repList.Tasks.First(); Assert.IsFalse(repTask.Completed); }
public void AddDuplicateTaskToTodoListTest() { var repo = new TodoRepository(); var todoList = new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }; repo.AddTodoList(todoList); var todoTask = new TodoTask { Id = Guid.NewGuid().ToString(), Name = "Task name", Completed = false }; repo.AddTaskToTodoList(todoList.Id, todoTask); var result = repo.AddTaskToTodoList(todoList.Id, todoTask); Assert.IsFalse(result); }
public void AddTaskToWrongTodoListTest() { var repo = new TodoRepository(); var todoList = new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }; repo.AddTodoList(todoList); var todoTask = new TodoTask { Id = Guid.NewGuid().ToString(), Name = "Task name", Completed = false }; repo.AddTaskToTodoList("111", todoTask); }