public async Task SendPostMessage_ProcessedByJsonApi() { var client = new WebApplicationFactory <Startup>().CreateClient(); var successResponse = await client.PostJsonAsync("comments", new CommentCandidate { Result = CommentCandidate.Success }); var innerErrorResponse = await client.PostJsonAsync("comments", new CommentCandidate { Result = CommentCandidate.InternalServiceError }); var badRequestResponse = await client.PostJsonAsync("comments", new CommentCandidate { Result = CommentCandidate.BadRequest }); var somethingResponse = await client.PostJsonAsync("comments", new CommentCandidate { Result = "something" }); Assert.AreEqual(HttpStatusCode.OK, successResponse.StatusCode); Assert.AreEqual(HttpStatusCode.InternalServerError, innerErrorResponse.StatusCode); Assert.AreEqual(HttpStatusCode.BadRequest, badRequestResponse.StatusCode); Assert.AreEqual(HttpStatusCode.InternalServerError, somethingResponse.StatusCode); }