File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed
Microsoft.OpenApi.Hidi.Tests Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
4
using System ;
@@ -135,5 +135,22 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments
135
135
var message2 = Assert . Throws < InvalidOperationException > ( ( ) => OpenApiFilterService . CreatePredicate ( "users.user.ListUser" , "users.user" ) ) . Message ;
136
136
Assert . Equal ( "Cannot specify both operationIds and tags at the same time." , message2 ) ;
137
137
}
138
+
139
+ [ Theory ]
140
+ [ InlineData ( "reports.getTeamsUserActivityUserDetail-a3f1" , null ) ]
141
+ [ InlineData ( null , "reports.Functions" ) ]
142
+ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags ( string operationIds , string tags )
143
+ {
144
+ // Act
145
+ var predicate = OpenApiFilterService . CreatePredicate ( operationIds , tags ) ;
146
+ var subsetOpenApiDocument = OpenApiFilterService . CreateFilteredDocument ( _openApiDocumentMock , predicate ) ;
147
+
148
+ // Assert
149
+ foreach ( var pathItem in subsetOpenApiDocument . Paths )
150
+ {
151
+ Assert . True ( pathItem . Value . Parameters . Any ( ) ) ;
152
+ Assert . Equal ( 1 , pathItem . Value . Parameters . Count ) ;
153
+ }
154
+ }
138
155
}
139
156
}
Original file line number Diff line number Diff line change @@ -116,6 +116,21 @@ public static OpenApiDocument CreateOpenApiDocument()
116
116
}
117
117
}
118
118
}
119
+ } ,
120
+ Parameters = new List < OpenApiParameter >
121
+ {
122
+ {
123
+ new OpenApiParameter ( )
124
+ {
125
+ Name = "period" ,
126
+ In = ParameterLocation . Path ,
127
+ Required = true ,
128
+ Schema = new OpenApiSchema ( )
129
+ {
130
+ Type = "string"
131
+ }
132
+ }
133
+ }
119
134
}
120
135
} ,
121
136
[ "/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})" ] = new OpenApiPathItem ( )
@@ -175,7 +190,20 @@ public static OpenApiDocument CreateOpenApiDocument()
175
190
}
176
191
}
177
192
}
178
- }
193
+ } ,
194
+ Parameters = new List < OpenApiParameter >
195
+ {
196
+ new OpenApiParameter
197
+ {
198
+ Name = "period" ,
199
+ In = ParameterLocation . Path ,
200
+ Required = true ,
201
+ Schema = new OpenApiSchema ( )
202
+ {
203
+ Type = "string"
204
+ }
205
+ }
206
+ }
179
207
} ,
180
208
[ "/users" ] = new OpenApiPathItem ( )
181
209
{
You can’t perform that action at this time.
0 commit comments