public async Task DocumentClient_BuildHttpClientFactory_WithHandler()
        {
            HttpMessageHandler messageHandler   = new CustomMessageHandler();
            ConnectionPolicy   connectionPolicy = new ConnectionPolicy();
            HttpClient         httpClient       = DocumentClient.BuildHttpClient(connectionPolicy, ApiType.None, messageHandler);

            Assert.IsNotNull(httpClient);
            HttpResponseMessage response = await httpClient.GetAsync("https://localhost");

            Assert.AreEqual(HttpStatusCode.Conflict, response.StatusCode);
        }
        public void DocumentClient_BuildHttpClientFactory_WithFactory()
        {
            HttpClient staticHttpClient = new HttpClient();

            Mock <Func <HttpClient> > mockFactory = new Mock <Func <HttpClient> >();

            mockFactory.Setup(f => f()).Returns(staticHttpClient);

            ConnectionPolicy connectionPolicy = new ConnectionPolicy()
            {
                HttpClientFactory = mockFactory.Object
            };

            HttpClient httpClient = DocumentClient.BuildHttpClient(connectionPolicy, ApiType.None, messageHandler: null);

            Assert.IsNotNull(httpClient);
            Assert.IsNotNull(httpClient);

            Mock.Get(mockFactory.Object)
            .Verify(f => f(), Times.Once);
        }