@@ -48,7 +48,7 @@ public void GetPathsForGraphBetaModelReturnsAllPaths()
48
48
49
49
// Assert
50
50
Assert . NotNull ( paths ) ;
51
- Assert . Equal ( 17401 , paths . Count ( ) ) ;
51
+ Assert . Equal ( 13727 , paths . Count ( ) ) ;
52
52
}
53
53
54
54
[ Fact ]
@@ -67,7 +67,7 @@ public void GetPathsForGraphBetaModelWithDerivedTypesConstraintReturnsAllPaths()
67
67
68
68
// Assert
69
69
Assert . NotNull ( paths ) ;
70
- Assert . Equal ( 13730 , paths . Count ( ) ) ;
70
+ Assert . Equal ( 13712 , paths . Count ( ) ) ;
71
71
}
72
72
73
73
[ Fact ]
@@ -276,6 +276,80 @@ public void GetPathsWithBoundActionOperationWorks()
276
276
Assert . Contains ( "/Customers({ID})/NS.renew" , paths . Select ( p => p . GetPathItemName ( ) ) ) ;
277
277
}
278
278
279
+ [ Theory ]
280
+ [ InlineData ( true ) ]
281
+ [ InlineData ( false ) ]
282
+ public void GetPathsWithBoundActionOperationForContainmentNavigationPropertyPathsWorks ( bool containsTarget )
283
+ {
284
+ // Arrange
285
+ string navProp = $@ "<NavigationProperty Name=""Referral"" Type=""NS.NiceCustomer"" ContainsTarget=""{ containsTarget } ""/>";
286
+ string boundAction =
287
+ @"<Action Name=""Ack"" IsBound=""true"">
288
+ <Parameter Name=""bindingParameter"" Type=""NS.NiceCustomer"" />
289
+ <ReturnType Type=""Edm.Boolean"" />
290
+ </Action>
291
+ <EntityType Name=""NiceCustomer"">
292
+ <Property Name=""Other"" Type=""Edm.Int32"" Nullable=""true"" />
293
+ </EntityType>" ;
294
+
295
+ IEdmModel model = GetEdmModel ( boundAction , "" , navProp ) ;
296
+ ODataPathProvider provider = new ODataPathProvider ( ) ;
297
+ var settings = new OpenApiConvertSettings ( ) ;
298
+
299
+ // Act
300
+ var paths = provider . GetPaths ( model , settings ) ;
301
+
302
+ // Assert
303
+ Assert . NotNull ( paths ) ;
304
+ Assert . Equal ( 4 , paths . Count ( ) ) ;
305
+
306
+ if ( containsTarget )
307
+ {
308
+ Assert . Contains ( "/Customers({ID})/Referral/NS.Ack" , paths . Select ( p => p . GetPathItemName ( ) ) ) ;
309
+ }
310
+ else
311
+ {
312
+ Assert . DoesNotContain ( "/Customers({ID})/Referral/NS.Ack" , paths . Select ( p => p . GetPathItemName ( ) ) ) ;
313
+ }
314
+ }
315
+
316
+ [ Theory ]
317
+ [ InlineData ( true ) ]
318
+ [ InlineData ( false ) ]
319
+ public void GetPathsWithBoundFunctionOperationForContainmentNavigationPropertyPathsWorks ( bool containsTarget )
320
+ {
321
+ // Arrange
322
+ string navProp = $@ "<NavigationProperty Name=""Referral"" Type=""NS.NiceCustomer"" ContainsTarget=""{ containsTarget } ""/>";
323
+ string boundAction =
324
+ @"<Function Name=""Search"" IsBound=""true"">
325
+ <Parameter Name=""bindingParameter"" Type=""NS.NiceCustomer"" />
326
+ <ReturnType Type=""Collection(NS.Customer)"" />
327
+ </Function>
328
+ <EntityType Name=""NiceCustomer"">
329
+ <Property Name=""Other"" Type=""Edm.Int32"" Nullable=""true"" />
330
+ </EntityType>" ;
331
+
332
+ IEdmModel model = GetEdmModel ( boundAction , "" , navProp ) ;
333
+ ODataPathProvider provider = new ODataPathProvider ( ) ;
334
+ var settings = new OpenApiConvertSettings ( ) ;
335
+
336
+ // Act
337
+ var paths = provider . GetPaths ( model , settings ) ;
338
+
339
+ // Assert
340
+ Assert . NotNull ( paths ) ;
341
+ Assert . Equal ( 4 , paths . Count ( ) ) ;
342
+
343
+ if ( containsTarget )
344
+ {
345
+ Assert . Contains ( "/Customers({ID})/Referral/NS.Search()" , paths . Select ( p => p . GetPathItemName ( ) ) ) ;
346
+ }
347
+ else
348
+ {
349
+ Assert . DoesNotContain ( "/Customers({ID})/Referral/NS.Search()" , paths . Select ( p => p . GetPathItemName ( ) ) ) ;
350
+ }
351
+ }
352
+
279
353
[ Fact ]
280
354
public void GetPathsWithUnboundOperationImportWorks ( )
281
355
{
@@ -500,7 +574,7 @@ public void GetPathsWithStreamPropertyAndWithEntityHasStreamWorks(bool hasStream
500
574
}
501
575
}
502
576
503
- private static IEdmModel GetEdmModel ( string schemaElement , string containerElement )
577
+ private static IEdmModel GetEdmModel ( string schemaElement , string containerElement , string propertySchema = null )
504
578
{
505
579
string template = $@ "<?xml version=""1.0"" encoding=""utf-16""?>
506
580
<Schema Namespace=""NS"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
@@ -509,6 +583,7 @@ private static IEdmModel GetEdmModel(string schemaElement, string containerEleme
509
583
<PropertyRef Name=""ID"" />
510
584
</Key>
511
585
<Property Name=""ID"" Type=""Edm.Int32"" Nullable=""false"" />
586
+ { propertySchema }
512
587
</EntityType>
513
588
{ schemaElement }
514
589
<EntityContainer Name =""Default"">
0 commit comments