public async void AddedPostResponseShouldBeReturned() { // Arrange const string otherComponentBaseUrl = "https://api.othercomponent.com/"; var serviceCollection = new ServiceCollection(); serviceCollection.Configure <AppSettings>(settings => { settings.OtherComponentBaseUrl = otherComponentBaseUrl; }); var httpMessageHandler = new TestHttpMessageHandler(); httpMessageHandler.PushResponse( new Tuple <HttpMethod, Uri>( HttpMethod.Post, new Uri(new Uri(otherComponentBaseUrl), "/data")), HttpStatusCode.OK, "Mellon!" ); var fixture = new AuthorizedTestFixture <DemoStartup>(httpMessageHandler: httpMessageHandler, serviceCollection: serviceCollection); // Act var request = new HttpRequestMessage(HttpMethod.Post, ApiEndpointPostToOtherComponent); request.Headers.Add("Authorization", "Bearer " + fixture.TokenService.GetToken()); var response = await fixture.HttpClient.SendAsync(request); // Assert Assert.True(response.IsSuccessStatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode); var responseString = await response.Content.ReadAsAsync <string>(); Assert.Equal(responseString, "Mellon!"); }