public void GetTodoListWithLimitTest() { var repo = new TodoRepository(); repo.AddTodoList(new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }); repo.AddTodoList(new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }); repo.AddTodoList(new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }); var items = repo.GetTodoLists("", null, 2); Assert.AreEqual(2, items.Count()); }
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 GetTodoListsWithSearchTest() { var repo = new TodoRepository(); var todoList = new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }; repo.AddTodoList(todoList); repo.AddTodoList(new TodoList { Id = Guid.NewGuid().ToString(), Name = "List", Description = "Description" }); var items = repo.GetTodoLists("Name", null, null); Assert.AreEqual(1, items.Count()); Assert.AreEqual(todoList.Id, items.First().Id); }
public void FindTodoListTest() { var repo = new TodoRepository(); var todoList = new TodoList { Id = Guid.NewGuid().ToString(), Name = "Name", Description = "Description" }; repo.AddTodoList(todoList); var repList = repo.FindTodoList(todoList.Id); Assert.IsNotNull(repList); Assert.AreEqual(todoList.Id, repList.Id); }
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); }
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); }