System.Net.Http.WinHttpHandlerUnitTests.WinHttpHandlerTest.SendAsync_WinHttpOpenReturnsError_ExpectHttpRequestException C# (CSharp) Method

SendAsync_WinHttpOpenReturnsError_ExpectHttpRequestException() private method

        public async Task SendAsync_WinHttpOpenReturnsError_ExpectHttpRequestException()
        {
            var handler = new WinHttpHandler();
            var client = new HttpClient(handler);
            var request = new HttpRequestMessage(HttpMethod.Get, TestServer.FakeServerEndpoint);

            TestControl.WinHttpOpen.ErrorWithApiCall = true;

            Exception ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.SendAsync(request));
            Assert.Equal(typeof(WinHttpException), ex.InnerException.GetType());
        }
        
WinHttpHandlerTest