public async Task AddTodoList()
        {
            TodoList todoList = new TodoList()
            {
                TodoListId = 2, Title = "Nice to have"
            };

            HttpResult <TodoList> result = await client.AddTodoListAsync(todoList);

            Assert.IsNotNull(result, "Result is null");
            Assert.IsTrue(result.Succeeded, GetRequestFailedMessage(result));
            Assert.AreEqual(todoList.TodoListId, result.Content.TodoListId, "New TodoList ID does not match.");
            Assert.AreEqual(todoList.Title, result.Content.Title, "New TodoList title does not match");
            Assert.AreEqual(result.Content.UserId, username, "New TodoList user ID does not match");
        }
        private async void AddAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            HttpResult <TodoList> result;

            using (TodoClient todoClient = ClientFactory.CreateTodoClient())
            {
                result = await todoClient.AddTodoListAsync(new TodoList()
                {
                    Title = "New Todo List"
                });
            }

            if (result.Succeeded)
            {
                TodoPageModel.TodoLists.Add(new TodoListModel(result.Content));
            }
            else
            {
                await ErrorDialog.ShowErrorsAsync(result.Errors);
            }
        }
Beispiel #3
0
        private async void OkButton_Click(object sender, EventArgs e)
        {
            TodoList todoList = new TodoList()
            {
                Title = TitleTextBox.Text, UserId = "unknown"
            };

            HttpResult <TodoList> result;

            using (TodoClient todoClient = ClientFactory.CreateTodoClient())
            {
                result = await todoClient.AddTodoListAsync(todoList);
            }

            if (result.Succeeded)
            {
                this.NavigationService.GoBack();
            }
            else
            {
                ErrorDialog.ShowErrors(result.Errors);
            }
        }