System.Net.Tests.HttpWebRequestTest.GetResponseAsync_ServerNameNotInDns_ThrowsWebException C# (CSharp) Method

GetResponseAsync_ServerNameNotInDns_ThrowsWebException() private method

        public void GetResponseAsync_ServerNameNotInDns_ThrowsWebException()
        {
            string serverUrl = string.Format("http://www.{0}.com/", Guid.NewGuid().ToString());
            HttpWebRequest request = WebRequest.CreateHttp(serverUrl);
            WebException ex = Assert.Throws<WebException>(() => request.GetResponseAsync().GetAwaiter().GetResult());
            Assert.Equal(WebExceptionStatus.NameResolutionFailure, ex.Status);

        }
HttpWebRequestTest