This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
tests/IntegrationTests/Download Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,12 @@ public static WebResponse GetResponseWithoutException(this WebRequest request)
85
85
}
86
86
catch ( WebException e )
87
87
{
88
- return e . Response ;
88
+ if ( e . Response != null )
89
+ {
90
+ return e . Response ;
91
+ }
92
+
93
+ throw e ;
89
94
}
90
95
}
91
96
}
Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ public void TestDownloadFailure()
81
81
exceptionThrown . Should ( ) . NotBeNull ( ) ;
82
82
}
83
83
84
-
85
84
[ Test ]
86
85
public void TestDownloadTextTask ( )
87
86
{
@@ -92,6 +91,26 @@ public void TestDownloadTextTask()
92
91
var resultLines = result . Split ( new [ ] { '\n ' } , StringSplitOptions . RemoveEmptyEntries ) ;
93
92
resultLines [ 0 ] . Should ( ) . Be ( "# If you would like to crawl GitHub contact us at [email protected] ." ) ;
94
93
}
94
+
95
+ [ Test ]
96
+ public void TestDownloadTextFailture ( )
97
+ {
98
+ InitializeTaskManager ( ) ;
99
+
100
+ var downloadTask = new DownloadTextTask ( CancellationToken . None , "https://ggggithub.com/robots.txt" ) ;
101
+ var exceptionThrown = false ;
102
+
103
+ try
104
+ {
105
+ var result = downloadTask . Start ( ) . Result ;
106
+ }
107
+ catch ( Exception e )
108
+ {
109
+ exceptionThrown = true ;
110
+ }
111
+
112
+ exceptionThrown . Should ( ) . BeTrue ( ) ;
113
+ }
95
114
96
115
[ Test ]
97
116
public void TestDownloadFileAndHash ( )
You can’t perform that action at this time.
0 commit comments