public async Task Test_AddItems() { await _toDoService.CreateList(_mockList_1); await _toDoService.AddItem(_mockList_1.Id, _mockItem_1); await _toDoService.AddItem(_mockList_1.Id, _mockItem_2); var list = await _toDoService.GetList(_mockList_1.Id); CollectionAssert.Contains(list.Items, _mockItem_1); CollectionAssert.Contains(list.Items, _mockItem_2); }
private async void Create() { try { var setNamePopupPage = new SetNamePopupPage() { Header = "Item Name", Body = "Set item name" }; await _popupNavigation.PushAsync(setNamePopupPage); string name = await setNamePopupPage.Task; ToDoItem newItem = new ToDoItem { Id = Guid.NewGuid(), Name = name }; await _toDoService.AddItem(_list.Id, newItem); Items.Add(newItem); OnPropertyChanged(nameof(Items)); // To show/hide list } catch (OperationCanceledException) { Debug.WriteLine("User cancelled setting name"); } catch (Exception ex) { Debug.Fail("Error creating item", ex.Message); } }