public async Task Apply_The_Correct_Host_Header_To_Its_Outbound_Request() { const string expectedHeaderValue = "host"; var client = new RestaurantSearchHttpClient("http://localhost/?q={0}", "tenant", "language", AuthenticationSchemes.Basic, "accessToken", "host", _httpClient); await client.GetRestaurants("SE19"); _fakeHttpMessageHandler.Verify(x => x.Send(It.Is <HttpRequestMessage>(message => message.Headers.First(header => header.Key == "Host").Value.ToList()[0] == expectedHeaderValue))); }
public async Task Send_A_Request_To_The_Correct_Outbound_Uri() { // Arrange const string expectedOutboundRequestUri = "http://localhost/?q=SE19"; var client = new RestaurantSearchHttpClient("http://localhost/?q={0}", "tenant", "language", AuthenticationSchemes.Basic, "accessToken", "host", _httpClient); // Act await client.GetRestaurants("SE19"); // Assert _fakeHttpMessageHandler.Verify(x => x.Send(It.Is <HttpRequestMessage>(message => message.RequestUri.ToString() == expectedOutboundRequestUri))); }