protected HttpRequestMessage BuildRequest(HttpMethod method, string path, string body)
 {
     return(new HttpRequestMessage()
            .WithMethod(method)
            .WithUri(MockServerClient.ServerAddress(path))
            .WithBody(body));
 }
 private async Task <HttpResponseMessage> SendHello(HttpScheme scheme)
 {
     using (var client = new HttpClient(Handler, false))
     {
         var host = MockServerClient.ServerAddress().Host;
         var port = MockServerClient.ServerAddress().Port;
         return(await client.GetAsync(new Uri($"{scheme}://{host}:{port}/hello")));
     }
 }
        public void ShouldForwardRequestUsingHttpSchemeEnum()
        {
            // arrange
            var request = Request().WithMethod("GET").WithPath("/hello");

            var host = MockServerClient.ServerAddress().Host;
            var port = MockServerClient.ServerAddress().Port;

            MockServerClient
            .When(request, Times.Exactly(1))
            .Forward(Forward()
                     .WithScheme(HttpScheme.Https)
                     .WithHost(host)
                     .WithPort(port));

            // act
            SendRequest(BuildGetRequest("/hello"), out _, out _);

            var result = MockServerClient.RetrieveRecordedRequests(request);

            // assert
            Assert.Equal(2, result.Length);
        }