Ejemplo n.º 1
0
        private async void Create()
        {
            try
            {
                var setNamePopupPage = new SetNamePopupPage()
                {
                    Header = "List Name",
                    Body   = "Set a list name"
                };

                await _popupNavigation.PushAsync(setNamePopupPage);

                string name = await setNamePopupPage.Task;

                ToDoList newList = new ToDoList
                {
                    Id   = Guid.NewGuid(),
                    Name = name
                };

                await _toDoService.CreateList(newList);

                Lists.Add(newList);

                await Navigation.PushAsync <ItemsPage, ItemsPageModel>(x => x.Init(newList));
            }
            catch (OperationCanceledException)
            {
                Debug.WriteLine("User cancelled setting name");
            }
            catch (Exception ex)
            {
                Debug.Fail("Error creating list", ex.Message);
            }
        }
Ejemplo n.º 2
0
        public async Task Test_CreateList()
        {
            await _toDoService.CreateList(_mockList_1);

            var lists = await _toDoService.GetAllLists();

            Assert.That(lists.Count(x => x.Id == _mockList_1.Id), Is.EqualTo(1));
        }