public async Task HttpTesterClientWithoutHeaders_Success()
        {
            using (var client = new HttpTesterClient())
            {
                var response = await client
                               .CreateHttpRequest(new Uri("https://qatoolkitapi.azurewebsites.net"))
                               .WithQueryParams(new Dictionary <string, string>()
                {
                    { "api-version", "1" }
                })
                               .WithMethod(HttpMethod.Post)
                               .WithJsonBody(BicycleFixture.GetCfr())
                               .WithPath("/api/bicycles")
                               .Start();

                var msg = await response.GetResponseJsonBody <Bicycle>();

                var expectedResponse = BicycleFixture.GetCfr().ToExpectedObject();
                expectedResponse.ShouldEqual(msg);

                Assert.True(client.Duration < 2000);
                Assert.True(response.IsSuccessStatusCode);
                Assert.Equal("Giant", msg.Brand);
            }
        }
 public async Task HttpTesterClientPostObjectBodyWithBlankCertificateDefaultAuthorization_Success()
 {
     using (var client = new HttpTesterClient())
     {
         await Assert.ThrowsAsync <HttpRequestException>(async() => await client
                                                         .CreateHttpRequest(new Uri("https://qatoolkitapi.azurewebsites.net/api/bicycles?api-version=1"))
                                                         .WithJsonBody(BicycleFixture.GetCfr())
                                                         .WithMethod(HttpMethod.Post)
                                                         .WithCertificateAuthentication(new X509Certificate2())
                                                         .Start());
     }
 }
        public async Task HttpTesterClientPostObjectBodyWithFulUrl_Success()
        {
            using (var client = new HttpTesterClient())
            {
                var response = await client
                               .CreateHttpRequest(new Uri("https://qatoolkitapi.azurewebsites.net/api/bicycles?api-version=1"))
                               .WithJsonBody(BicycleFixture.GetCfr())
                               .WithMethod(HttpMethod.Post)
                               .Start();

                var msg = await response.GetResponseJsonBody <dynamic>();

                Assert.True(client.Duration < 2000);
                Assert.True(response.IsSuccessStatusCode);
                Assert.Equal("Giant", msg.brand.ToString());
            }
        }