@@ -16,20 +16,7 @@ class StupidClass {
1616
1717 readonly WireMockServer _server = WireMockServer . Start ( ) ;
1818
19- /// <summary>
20- /// Success of this test is based largely on the behavior of your current DNS.
21- /// For example, if you're using OpenDNS this will test will fail; ResponseStatus will be Completed.
22- /// </summary>
23- [ Fact ]
24- public async Task Handles_Non_Existent_Domain ( ) {
25- using var client = new RestClient ( "http://nonexistantdomainimguessing.org" ) ;
26-
27- var request = new RestRequest ( "foo" ) ;
28- var response = await client . ExecuteAsync ( request ) ;
29-
30- response . ResponseStatus . Should ( ) . Be ( ResponseStatus . Error ) ;
31- }
32-
19+ #if NET
3320 [ Fact ]
3421 public async Task Handles_HttpClient_Timeout_Error ( ) {
3522 using var client = new RestClient ( new HttpClient { Timeout = TimeSpan . FromMilliseconds ( 500 ) } ) ;
@@ -40,8 +27,8 @@ public async Task Handles_HttpClient_Timeout_Error() {
4027 response . ErrorException . Should ( ) . BeOfType < TaskCanceledException > ( ) ;
4128 response . ResponseStatus . Should ( ) . Be ( ResponseStatus . TimedOut , response . ErrorMessage ) ;
4229 }
30+ #endif
4331
44- #if NET
4532 [ Fact ]
4633 public async Task Handles_Server_Timeout_Error ( ) {
4734 using var client = new RestClient ( _server . Url ! ) ;
@@ -52,7 +39,6 @@ public async Task Handles_Server_Timeout_Error() {
5239 response . ErrorException . Should ( ) . BeOfType < TaskCanceledException > ( ) ;
5340 response . ResponseStatus . Should ( ) . Be ( ResponseStatus . TimedOut ) ;
5441 }
55- #endif
5642
5743 [ Fact ]
5844 public async Task Handles_Server_Timeout_Error_With_Deserializer ( ) {
@@ -67,7 +53,7 @@ public async Task Handles_Server_Timeout_Error_With_Deserializer() {
6753 }
6854
6955 [ Fact ]
70- public async Task Task_Handles_Non_Existent_Domain ( ) {
56+ public async Task Handles_Non_Existent_Domain ( ) {
7157 using var client = new RestClient ( "http://this.cannot.exist:8001" ) ;
7258
7359 var request = new RestRequest ( "/" ) {
@@ -77,7 +63,6 @@ public async Task Task_Handles_Non_Existent_Domain() {
7763 var response = await client . ExecuteAsync < StupidClass > ( request ) ;
7864
7965 response . ErrorException . Should ( ) . BeOfType < HttpRequestException > ( ) ;
80- response . ErrorException ! . Message . Should ( ) . Contain ( "known" , response . ErrorMessage ) ;
8166 response . ResponseStatus . Should ( ) . Be ( ResponseStatus . Error ) ;
8267 }
8368}
0 commit comments