@@ -44,7 +44,8 @@ public void GetSwagger_GeneratesSwaggerDocument_ForApiDescriptionsWithMatchingGr
44
44
{
45
45
SwaggerDocs = new Dictionary < string , OpenApiInfo >
46
46
{
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" } ,
48
49
}
49
50
}
50
51
) ;
@@ -55,6 +56,14 @@ public void GetSwagger_GeneratesSwaggerDocument_ForApiDescriptionsWithMatchingGr
55
56
Assert . Equal ( "Test API" , document . Info . Title ) ;
56
57
Assert . Equal ( new [ ] { "/resource" } , document . Paths . Keys . ToArray ( ) ) ;
57
58
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 ) ;
58
67
}
59
68
60
69
[ Theory ]
@@ -1160,6 +1169,7 @@ public void GetSwagger_SupportsOption_IgnoreObsoleteActions()
1160
1169
1161
1170
Assert . Equal ( new [ ] { "/resource" } , document . Paths . Keys . ToArray ( ) ) ;
1162
1171
Assert . Equal ( new [ ] { OperationType . Post } , document . Paths [ "/resource" ] . Operations . Keys ) ;
1172
+ Assert . Single ( document . Paths [ "/resource" ] . Operations ) ;
1163
1173
}
1164
1174
1165
1175
[ Fact ]
@@ -1190,6 +1200,9 @@ public void GetSwagger_SupportsOption_SortKeySelector()
1190
1200
var document = subject . GetSwagger ( "v1" ) ;
1191
1201
1192
1202
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 ) ;
1193
1206
}
1194
1207
1195
1208
[ Fact ]
@@ -1316,6 +1329,7 @@ public void GetSwagger_SupportsOption_ConflictingActionsResolver()
1316
1329
1317
1330
Assert . Equal ( new [ ] { "/resource" } , document . Paths . Keys . ToArray ( ) ) ;
1318
1331
Assert . Equal ( new [ ] { OperationType . Post } , document . Paths [ "/resource" ] . Operations . Keys ) ;
1332
+ Assert . Single ( document . Paths [ "/resource" ] . Operations ) ;
1319
1333
}
1320
1334
1321
1335
[ Theory ]
@@ -2050,7 +2064,7 @@ public void GetSwagger_Works_As_Expected_When_FromFormObject()
2050
2064
var mediaType = operation . RequestBody . Content [ "multipart/form-data" ] ;
2051
2065
Assert . NotNull ( mediaType . Schema ) ;
2052
2066
Assert . NotNull ( mediaType . Schema . Reference ) ;
2053
- Assert . Equal ( typeof ( SwaggerIngoreAnnotatedType ) . Name , mediaType . Schema . Reference . Id ) ;
2067
+ Assert . Equal ( nameof ( SwaggerIngoreAnnotatedType ) , mediaType . Schema . Reference . Id ) ;
2054
2068
Assert . Empty ( mediaType . Encoding ) ;
2055
2069
}
2056
2070
@@ -2094,7 +2108,7 @@ public void GetSwagger_Works_As_Expected_When_FromFormObject_AndString()
2094
2108
Assert . NotEmpty ( mediaType . Schema . AllOf ) ;
2095
2109
Assert . Equal ( 2 , mediaType . Schema . AllOf . Count ) ;
2096
2110
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 ) ;
2098
2112
Assert . NotEmpty ( mediaType . Schema . AllOf [ 1 ] . Properties ) ;
2099
2113
Assert . Equal ( [ "param2" ] , mediaType . Schema . AllOf [ 1 ] . Properties . Keys ) ;
2100
2114
Assert . NotEmpty ( mediaType . Encoding ) ;
@@ -2130,7 +2144,7 @@ public void GetSwagger_Works_As_Expected_When_TypeIsEnum_AndModelMetadataTypeIsS
2130
2144
Assert . Equal ( "param1" , operation . Parameters [ 0 ] . Name ) ;
2131
2145
Assert . NotNull ( operation . Parameters [ 0 ] . Schema ) ;
2132
2146
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 ) ;
2134
2148
}
2135
2149
2136
2150
[ Fact ]
0 commit comments