@@ -25,20 +25,22 @@ public async Task SwaggerUiDocs()
25
25
c . MobileAppUi ( config ) ;
26
26
} ) ;
27
27
28
- string o2cExpected = GetResourceString ( "Microsoft.Azure.Mobile.Server.Swagger.o2c.html" ) ;
29
- // string oauthExpected = GetResourceString( "Microsoft.Azure.Mobile.Server.Swagger.swagger-oauth. js");
28
+ await ValidateResource ( server , "Microsoft.Azure.Mobile.Server.Swagger.o2c.html" , "http://localhost/swagger/ui/o2c- html") ;
29
+ await ValidateResource ( server , "Microsoft.Azure.Mobile.Server.Swagger.swagger-ui.min.js" , "http://localhost/swagger/ui/swagger-ui-min- js") ;
30
30
31
- // Act
32
- var o2cResponse = await server . HttpClient . GetAsync ( "http://localhost/swagger/ui/o2c-html" ) ;
33
- // var oauthResponse = await server.HttpClient.GetAsync("http://localhost/swagger/ui/lib/swagger-oauth-js");
31
+ Assert . Contains ( typeof ( SwaggerUiSecurityFilter ) , config . MessageHandlers . Select ( h => h . GetType ( ) ) ) ;
32
+ }
34
33
35
- string o2c = await o2cResponse . Content . ReadAsStringAsync ( ) ;
36
- // string oauth = await oauthResponse.Content.ReadAsStringAsync();
34
+ private static async Task ValidateResource ( TestServer server , string resource , string requestUri )
35
+ {
36
+ string expected = GetResourceString ( resource ) ;
37
+
38
+ // Act
39
+ var response = await server . HttpClient . GetAsync ( requestUri ) ;
40
+ string actual = await response . Content . ReadAsStringAsync ( ) ;
37
41
38
42
// Assert
39
- Assert . Equal ( o2cExpected , o2c ) ;
40
- // Assert.Equal(oauthExpected, oauth);
41
- Assert . Contains ( typeof ( SwaggerUiSecurityFilter ) , config . MessageHandlers . Select ( h => h . GetType ( ) ) ) ;
43
+ Assert . Equal ( expected , actual ) ;
42
44
}
43
45
44
46
[ SuppressMessage ( "Microsoft.Usage" , "CA2202:Do not dispose objects multiple times" , Justification = "This code is resilient to this scenario" ) ]
0 commit comments