public async Task SHOULD_post_using_Default_RequestHeaders()
            {
                //Arrange
                MockHttpClientFactory.Where_CreateClient_returns(new HttpClient(MockMessageHandler.Build().Object));
                Sut.SetDefaultRequestHeader("frogs", "2");
                Sut.SetDefaultRequestHeader("pudding", "yes please");

                //Act
                await Sut.PostAsync("http://baseaddress.com/testroute", new TestDto { TestDtoProperty = "hello world" }, CancellationToken.None);

                //Assert
                MockMessageHandler.VerifyHeader("frogs", "2");
                MockMessageHandler.VerifyHeader("pudding", "yes please");
            }
        public async Task SHOULD_append_analytics_headers_if_present()
        {
            //Arrange
            MockAnalyticsService.With(x => x.AnalyticsOperationHeaders, new Dictionary <string, string>
            {
                { "analyticsHeaderKey", "analyticsHeaderValue" }
            });
            var wrapper = GetWrapper();

            MockHttpClientFactory.Where_CreateClient_returns(new HttpClient(MockMessageHandler.Build().Object));

            //Act
            await ExecuteAsync(wrapper, CancellationToken.None);

            //Assert
            MockMessageHandler.VerifyHeader("analyticsHeaderKey", "analyticsHeaderValue");
        }
        public async Task SHOULD_append_headers_if_provided()
        {
            //Arrange
            var wrapper = GetWrapper()
                          .WithRequestHeader("userId", "123")
                          .WithRequestHeader("name", "Bob")
                          .WithAuthorizationHeader("Bearer", "bearerToken");

            MockHttpClientFactory.Where_CreateClient_returns(new HttpClient(MockMessageHandler.Build().Object));

            //Act
            await ExecuteAsync(wrapper, CancellationToken.None);

            //Assert
            MockMessageHandler.VerifyHeader("userId", "123");
            MockMessageHandler.VerifyHeader("name", "Bob");
            MockMessageHandler.VerifyAuthHeader("Bearer", "bearerToken");
        }
        public async Task SHOULD_append_default_headers_if_set()
        {
            //Arrange
            var wrapper = GetWrapper();

            Sut.SetDefaultRequestHeader("userId", "123");
            Sut.SetDefaultRequestHeader("name", "Bob");
            MockAccessToken
            .With(x => x.Scheme, "Bearer")
            .With(x => x.Token, "bearerToken");
            MockHttpClientFactory.Where_CreateClient_returns(new HttpClient(MockMessageHandler.Build().Object));

            //Act
            await ExecuteAsync(wrapper, CancellationToken.None);

            //Assert
            MockMessageHandler.VerifyHeader("userId", "123");
            MockMessageHandler.VerifyHeader("name", "Bob");
            MockMessageHandler.VerifyAuthHeader("Bearer", "bearerToken");
        }
        public async Task SHOULD_append_acces_token_headers_if_set()
        {
            //Arrange
            var wrapper = GetWrapper();

            MockAccessToken
            .With(x => x.Scheme, "Bearer")
            .With(x => x.Token, "bearerToken")
            .With(x => x.AdditionalHeaders, new Dictionary <string, string>
            {
                { "h1", "header1" },
                { "h2", "header2" },
            });
            MockHttpClientFactory.Where_CreateClient_returns(new HttpClient(MockMessageHandler.Build().Object));

            //Act
            await ExecuteAsync(wrapper, CancellationToken.None);

            //Assert
            MockMessageHandler.VerifyHeader("h1", "header1");
            MockMessageHandler.VerifyHeader("h2", "header2");
            MockMessageHandler.VerifyAuthHeader("Bearer", "bearerToken");
        }