public async Task BeDeletedSuccessfully() { var model = AuthorBuilder.NewAuthor(); var postResponse = await this.HttpClient.SendAsync("/api/authors", HttpMethod.Post, Json.ToJson(model)); postResponse.StatusCode.Should().Be(HttpStatusCode.Created); var body = await postResponse.Content.ReadAsStringAsync(); var author = Json.ToObject <Author>(body); var deleteResponse = await this.HttpClient.SendAsync($"/api/authors/{author.Id}", HttpMethod.Delete); deleteResponse.StatusCode.Should().Be(HttpStatusCode.NoContent); }
public async Task BeCreatedSuccessfully() { var model = AuthorBuilder.NewAuthor(); var response = await this.HttpClient.SendAsync("/api/authors", HttpMethod.Post, Json.ToJson(model)); response.StatusCode.Should().Be(HttpStatusCode.Created); var body = await response.Content.ReadAsStringAsync(); var author = Json.ToObject <Author>(body); author.Should().Match <Author>(x => x.Name == $"{model.FirstName} {model.LastName}" && x.Genre == model.Genre); }