private async void DeleteList() { try { var confirmPopup = new ConfirmationPopupPage() { Header = "Delete", Body = "Are you sure you want to delete this list?", ConfirmButtonText = "Yes" }; await _popupNavigation.PushAsync(confirmPopup); if (!await confirmPopup.Task) { return; } await _toDoService.DeleteList(_list.Id); await Navigation.PopAsync(); } catch (Exception ex) { Debug.Fail("Error deleting list", ex.Message); } }
private async void Delete(ToDoList list) { try { var confirmPopup = new ConfirmationPopupPage() { Header = "Delete", Body = "Are you sure you want to delete this list?", ConfirmButtonText = "Yes" }; await _popupNavigation.PushAsync(confirmPopup); if (!await confirmPopup.Task) { return; } await _toDoService.DeleteList(list.Id); Lists.Remove(list); OnPropertyChanged(nameof(Lists)); // To show/hide list } catch (Exception ex) { Debug.Fail("Error deleting list", ex.Message); } }
public async Task Test_RemoveList() { await _toDoService.CreateList(_mockList_1); await _toDoService.DeleteList(_mockList_1.Id); var lists = await _toDoService.GetAllLists(); Assert.That(lists.Count(x => x.Id == _mockList_1.Id), Is.EqualTo(0)); }