@@ -44,7 +44,8 @@ public void GetSwagger_GeneratesSwaggerDocument_ForApiDescriptionsWithMatchingGr
4444 {
4545 SwaggerDocs = new Dictionary < string , OpenApiInfo >
4646 {
47- [ "v1" ] = new OpenApiInfo { Version = "V1" , Title = "Test API" }
47+ [ "v1" ] = new OpenApiInfo { Version = "V1" , Title = "Test API" } ,
48+ [ "v2" ] = new OpenApiInfo { Version = "V2" , Title = "Test API 2" } ,
4849 }
4950 }
5051 ) ;
@@ -55,6 +56,14 @@ public void GetSwagger_GeneratesSwaggerDocument_ForApiDescriptionsWithMatchingGr
5556 Assert . Equal ( "Test API" , document . Info . Title ) ;
5657 Assert . Equal ( new [ ] { "/resource" } , document . Paths . Keys . ToArray ( ) ) ;
5758 Assert . Equal ( new [ ] { OperationType . Post , OperationType . Get } , document . Paths [ "/resource" ] . Operations . Keys ) ;
59+ Assert . Equal ( 2 , document . Paths [ "/resource" ] . Operations . Count ) ;
60+
61+ var documentV2 = subject . GetSwagger ( "v2" ) ;
62+ Assert . Equal ( "V2" , documentV2 . Info . Version ) ;
63+ Assert . Equal ( "Test API 2" , documentV2 . Info . Title ) ;
64+ Assert . Equal ( new [ ] { "/resource" } , documentV2 . Paths . Keys . ToArray ( ) ) ;
65+ Assert . Equal ( new [ ] { OperationType . Post } , documentV2 . Paths [ "/resource" ] . Operations . Keys ) ;
66+ Assert . Single ( documentV2 . Paths [ "/resource" ] . Operations ) ;
5867 }
5968
6069 [ Theory ]
@@ -1160,6 +1169,7 @@ public void GetSwagger_SupportsOption_IgnoreObsoleteActions()
11601169
11611170 Assert . Equal ( new [ ] { "/resource" } , document . Paths . Keys . ToArray ( ) ) ;
11621171 Assert . Equal ( new [ ] { OperationType . Post } , document . Paths [ "/resource" ] . Operations . Keys ) ;
1172+ Assert . Single ( document . Paths [ "/resource" ] . Operations ) ;
11631173 }
11641174
11651175 [ Fact ]
@@ -1190,6 +1200,9 @@ public void GetSwagger_SupportsOption_SortKeySelector()
11901200 var document = subject . GetSwagger ( "v1" ) ;
11911201
11921202 Assert . Equal ( new [ ] { "/resource1" , "/resource2" , "/resource3" } , document . Paths . Keys . ToArray ( ) ) ;
1203+ Assert . Single ( document . Paths [ "/resource1" ] . Operations ) ;
1204+ Assert . Single ( document . Paths [ "/resource2" ] . Operations ) ;
1205+ Assert . Single ( document . Paths [ "/resource3" ] . Operations ) ;
11931206 }
11941207
11951208 [ Fact ]
@@ -1316,6 +1329,7 @@ public void GetSwagger_SupportsOption_ConflictingActionsResolver()
13161329
13171330 Assert . Equal ( new [ ] { "/resource" } , document . Paths . Keys . ToArray ( ) ) ;
13181331 Assert . Equal ( new [ ] { OperationType . Post } , document . Paths [ "/resource" ] . Operations . Keys ) ;
1332+ Assert . Single ( document . Paths [ "/resource" ] . Operations ) ;
13191333 }
13201334
13211335 [ Theory ]
@@ -2050,7 +2064,7 @@ public void GetSwagger_Works_As_Expected_When_FromFormObject()
20502064 var mediaType = operation . RequestBody . Content [ "multipart/form-data" ] ;
20512065 Assert . NotNull ( mediaType . Schema ) ;
20522066 Assert . NotNull ( mediaType . Schema . Reference ) ;
2053- Assert . Equal ( typeof ( SwaggerIngoreAnnotatedType ) . Name , mediaType . Schema . Reference . Id ) ;
2067+ Assert . Equal ( nameof ( SwaggerIngoreAnnotatedType ) , mediaType . Schema . Reference . Id ) ;
20542068 Assert . Empty ( mediaType . Encoding ) ;
20552069 }
20562070
@@ -2094,7 +2108,7 @@ public void GetSwagger_Works_As_Expected_When_FromFormObject_AndString()
20942108 Assert . NotEmpty ( mediaType . Schema . AllOf ) ;
20952109 Assert . Equal ( 2 , mediaType . Schema . AllOf . Count ) ;
20962110 Assert . NotNull ( mediaType . Schema . AllOf [ 0 ] . Reference ) ;
2097- Assert . Equal ( typeof ( SwaggerIngoreAnnotatedType ) . Name , mediaType . Schema . AllOf [ 0 ] . Reference . Id ) ;
2111+ Assert . Equal ( nameof ( SwaggerIngoreAnnotatedType ) , mediaType . Schema . AllOf [ 0 ] . Reference . Id ) ;
20982112 Assert . NotEmpty ( mediaType . Schema . AllOf [ 1 ] . Properties ) ;
20992113 Assert . Equal ( [ "param2" ] , mediaType . Schema . AllOf [ 1 ] . Properties . Keys ) ;
21002114 Assert . NotEmpty ( mediaType . Encoding ) ;
@@ -2130,7 +2144,7 @@ public void GetSwagger_Works_As_Expected_When_TypeIsEnum_AndModelMetadataTypeIsS
21302144 Assert . Equal ( "param1" , operation . Parameters [ 0 ] . Name ) ;
21312145 Assert . NotNull ( operation . Parameters [ 0 ] . Schema ) ;
21322146 Assert . NotNull ( operation . Parameters [ 0 ] . Schema . Reference ) ;
2133- Assert . Equal ( typeof ( IntEnum ) . Name , operation . Parameters [ 0 ] . Schema . Reference . Id ) ;
2147+ Assert . Equal ( nameof ( IntEnum ) , operation . Parameters [ 0 ] . Schema . Reference . Id ) ;
21342148 }
21352149
21362150 [ Fact ]
0 commit comments