@@ -136,10 +136,11 @@ public void GetServersReturnsAllEndpoints()
136
136
{
137
137
var apiDescription1 = GetValidDescription ( ) ;
138
138
var apiDescription2 = GetValidDescription ( ) ;
139
- var path = "default/path" ;
139
+ var firstPath = "first/path" ;
140
+ var secondPath = "second/path" ;
140
141
serverOptions . RoutePrefix = "/" ;
141
- apiDescription1 . RelativePath = $ "{ path } #{ MethodName } ";
142
- apiDescription2 . RelativePath = $ "{ path } #{ MethodName } ";
142
+ apiDescription1 . RelativePath = $ "{ firstPath } #{ MethodName } ";
143
+ apiDescription2 . RelativePath = $ "{ secondPath } #{ MethodName } ";
143
144
144
145
apiDescriptionsProviderMock . Setup ( static p => p . ApiDescriptionGroups )
145
146
. Returns ( new ApiDescriptionGroupCollection ( new List < ApiDescriptionGroup >
@@ -157,6 +158,32 @@ public void GetServersReturnsAllEndpoints()
157
158
result . Should ( ) . HaveCount ( 2 ) ;
158
159
}
159
160
161
+ [ Test ]
162
+ public void GetServersSameRouteReturnsOnlyOne ( )
163
+ {
164
+ var apiDescription1 = GetValidDescription ( ) ;
165
+ var apiDescription2 = GetValidDescription ( ) ;
166
+ var samePath = "default/path" ;
167
+ serverOptions . RoutePrefix = "/" ;
168
+ apiDescription1 . RelativePath = $ "{ samePath } #{ MethodName } ";
169
+ apiDescription2 . RelativePath = $ "{ samePath } #{ MethodName } ";
170
+
171
+ apiDescriptionsProviderMock . Setup ( static p => p . ApiDescriptionGroups )
172
+ . Returns ( new ApiDescriptionGroupCollection ( new List < ApiDescriptionGroup >
173
+ {
174
+ new ( null , new [ ] { apiDescription1 } ) ,
175
+ new ( null , new [ ] { apiDescription2 } ) ,
176
+ } ,
177
+ 0 ) )
178
+ . Verifiable ( ) ;
179
+
180
+ var result = documentGeneratorMock . Object . GetServers ( new Uri ( Host ) ) ;
181
+
182
+ apiDescriptionsProviderMock . Verify ( ) ;
183
+ documentGeneratorMock . Verify ( ) ;
184
+ result . Should ( ) . HaveCount ( 1 ) ;
185
+ }
186
+
160
187
[ Test ]
161
188
public void GetServersPathAndRoutePrefixSameReturnsEmptyServers ( )
162
189
{
0 commit comments