public void add_items_to_list() { service.CreateList(new TodoList { Id = 1, Name = "1st List" }); service.CreateList(new TodoList { Id = 2, Name = "2nd List" }); service.AddItemToList(new TodoItem { Id = 1, Description = "1st Item", TodoListId = 1 }); service.AddItemToList(new TodoItem { Id = 2, Description = "2nd Item", TodoListId = 1 }); service.AddItemToList(new TodoItem { Id = 3, Description = "3rd Item", TodoListId = 1 }); service.AddItemToList(new TodoItem { Id = 4, Description = "3rd Item", TodoListId = 2 }); var lists1 = service.GetItemsFromList(1).Result; var lists2 = service.GetItemsFromList(2).Result; Assert.IsTrue(lists1.Count == 3); Assert.IsTrue(lists2.Count == 1); }
public async Task <ActionResult <TodoItem> > AddTodoItem(NewTodoItem newItem) { // return return(Ok(await _todoService.AddItemToList(newItem))); }