File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/Mvc/test/Mvc.FunctionalTests Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System . Net ;
5+ using System . Net . Http ;
56using System . Net . Http . Headers ;
67
78namespace Microsoft . AspNetCore . Mvc . FunctionalTests ;
@@ -37,4 +38,20 @@ public async Task RetrievesDataFromRealServer()
3738 Assert . Contains ( "wall" , responseContent ) ;
3839 Assert . Contains ( "floor" , responseContent ) ;
3940 }
41+
42+ [ Fact ]
43+ public async Task ServerReachableViaGenericHttpClient ( )
44+ {
45+ // Arrange
46+ var baseAddress = new Uri ( "http://localhost:5000" ) ;
47+
48+ // Act
49+ using var factoryClient = Factory . CreateClient ( ) ;
50+ using var client = new HttpClient ( ) { BaseAddress = factoryClient . BaseAddress } ;
51+
52+ using var response = await client . GetAsync ( "/" ) ;
53+
54+ // Assert
55+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
56+ }
4057}
You can’t perform that action at this time.
0 commit comments