File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
src/libraries/System.Net.Requests/tests Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -2267,9 +2267,22 @@ public void SendHttpRequest_BindIPEndPoint_Throws()
22672267 // URI shouldn't matter because it should throw exception before connection open.
22682268 HttpWebRequest request = WebRequest . CreateHttp ( Configuration . Http . RemoteEchoServer ) ;
22692269 request . ServicePoint . BindIPEndPointDelegate = ( _ , _ , _ ) => ( IPEndPoint ) socket . LocalEndPoint ! ;
2270- var exception = await Assert . ThrowsAsync < WebException > ( ( ) =>
2271- bool . Parse ( async) ? request . GetResponseAsync ( ) : Task . Run ( ( ) => request . GetResponse ( ) ) ) ;
2272- Assert . IsType < OverflowException > ( exception . InnerException ? . InnerException ) ;
2270+ try
2271+ {
2272+ if ( bool . Parse ( async) )
2273+ {
2274+ await request . GetResponseAsync ( ) ;
2275+ }
2276+ else
2277+ {
2278+ request . GetResponse ( ) ;
2279+ }
2280+ Assert . Fail ( "Should throw OverflowException" ) ;
2281+ }
2282+ catch ( Exception ex )
2283+ {
2284+ Assert . IsType < OverflowException > ( ex . InnerException ? . InnerException ) ;
2285+ }
22732286 }
22742287 finally
22752288 {
You can’t perform that action at this time.
0 commit comments