public async Task GetTodos() { await using var application = new TodoApplication(); var client = application.CreateClient(); var todos = await client.GetFromJsonAsync <List <Todo> >("/todos"); Assert.Empty(todos); }
public async Task PostTodos() { await using var application = new TodoApplication(); var client = application.CreateClient(); var response = await client.PostAsJsonAsync("/todos", new Todo { Title = "I want to do this thing tomorrow" }); Assert.Equal(HttpStatusCode.Created, response.StatusCode); var todos = await client.GetFromJsonAsync <List <Todo> >("/todos"); var todo = Assert.Single(todos); Assert.Equal("I want to do this thing tomorrow", todo.Title); Assert.False(todo.IsComplete); }