@@ -310,22 +310,29 @@ public void CreateOperationForComposableOverloadEdmFunctionReturnsCorrectOperati
310
310
customer . AddKeys ( customer . AddStructuralProperty ( "ID" , EdmPrimitiveTypeKind . Int32 ) ) ;
311
311
model . AddElement ( customer ) ;
312
312
313
- EdmFunction function = new ( "NS" , "MyFunction" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
314
- function . AddParameter ( "entity ", new EdmEntityTypeReference ( customer , false ) ) ;
315
- function . AddParameter ( "param " , EdmCoreModel . Instance . GetString ( false ) ) ;
316
- model . AddElement ( function ) ;
313
+ // Overloaded function 1
314
+ EdmFunction function1 = new ( "NS ", "MyFunction1" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
315
+ function1 . AddParameter ( "entity " , new EdmEntityTypeReference ( customer , false ) ) ;
316
+ model . AddElement ( function1 ) ;
317
317
318
- function = new EdmFunction ( "NS" , "MyFunction" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
319
- function . AddParameter ( "entity" , new EdmEntityTypeReference ( customer , false ) ) ;
320
- function . AddParameter ( "param" , EdmCoreModel . Instance . GetString ( false ) ) ;
321
- function . AddParameter ( "param2" , EdmCoreModel . Instance . GetString ( false ) ) ;
322
- model . AddElement ( function ) ;
318
+ // Overloaded function 1
319
+ EdmFunction function2 = new ( "NS" , "MyFunction1" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
320
+ function2 . AddParameter ( "entity" , new EdmEntityTypeReference ( customer , false ) ) ;
321
+ function2 . AddParameter ( "param" , EdmCoreModel . Instance . GetString ( false ) ) ;
323
322
324
- EdmFunction function2 = new ( "NS" , "MyFunction2" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
325
- function2 . AddParameter ( "entity2" , new EdmEntityTypeReference ( customer , false ) ) ;
326
- function2 . AddParameter ( "param3" , EdmCoreModel . Instance . GetString ( false ) ) ;
327
323
model . AddElement ( function2 ) ;
328
324
325
+ // Overloaded function 2
326
+ EdmFunction function3 = new ( "NS" , "MyFunction2" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
327
+ function3 . AddParameter ( "entity2" , new EdmEntityTypeReference ( customer , false ) ) ;
328
+ model . AddElement ( function3 ) ;
329
+
330
+ // Overloaded function 2
331
+ EdmFunction function4 = new ( "NS" , "MyFunction2" , EdmCoreModel . Instance . GetString ( false ) , true , null , false ) ;
332
+ function4 . AddParameter ( "entity2" , new EdmEntityTypeReference ( customer , false ) ) ;
333
+ function4 . AddParameter ( "param" , EdmCoreModel . Instance . GetString ( false ) ) ;
334
+ model . AddElement ( function4 ) ;
335
+
329
336
EdmEntityContainer container = new ( "NS" , "Default" ) ;
330
337
EdmEntitySet customers = new ( container , "Customers" , customer ) ;
331
338
model . AddElement ( container ) ;
@@ -337,24 +344,51 @@ public void CreateOperationForComposableOverloadEdmFunctionReturnsCorrectOperati
337
344
} ;
338
345
ODataContext context = new ( model , settings ) ;
339
346
340
- ODataPath path = new ( new ODataNavigationSourceSegment ( customers ) ,
347
+ ODataPath path1 = new ( new ODataNavigationSourceSegment ( customers ) ,
341
348
new ODataKeySegment ( customer ) ,
342
- new ODataOperationSegment ( function ) ,
343
- new ODataOperationSegment ( function2 ) ) ;
349
+ new ODataOperationSegment ( function1 ) ,
350
+ new ODataOperationSegment ( function3 ) ) ;
351
+
352
+ ODataPath path2 = new ( new ODataNavigationSourceSegment ( customers ) ,
353
+ new ODataKeySegment ( customer ) ,
354
+ new ODataOperationSegment ( function1 ) ,
355
+ new ODataOperationSegment ( function4 ) ) ;
356
+
357
+ ODataPath path3 = new ( new ODataNavigationSourceSegment ( customers ) ,
358
+ new ODataKeySegment ( customer ) ,
359
+ new ODataOperationSegment ( function2 ) ,
360
+ new ODataOperationSegment ( function3 ) ) ;
361
+
362
+ ODataPath path4 = new ( new ODataNavigationSourceSegment ( customers ) ,
363
+ new ODataKeySegment ( customer ) ,
364
+ new ODataOperationSegment ( function2 ) ,
365
+ new ODataOperationSegment ( function4 ) ) ;
344
366
345
367
// Act
346
- var operation = _operationHandler . CreateOperation ( context , path ) ;
368
+ var operation1 = _operationHandler . CreateOperation ( context , path1 ) ;
369
+ var operation2 = _operationHandler . CreateOperation ( context , path2 ) ;
370
+ var operation3 = _operationHandler . CreateOperation ( context , path3 ) ;
371
+ var operation4 = _operationHandler . CreateOperation ( context , path4 ) ;
347
372
348
373
// Assert
349
- Assert . NotNull ( operation ) ;
374
+ Assert . NotNull ( operation1 ) ;
375
+ Assert . NotNull ( operation2 ) ;
376
+ Assert . NotNull ( operation3 ) ;
377
+ Assert . NotNull ( operation4 ) ;
350
378
351
379
if ( enableOperationId )
352
380
{
353
- Assert . Equal ( "Customers.Customer.MyFunction.MyFunction2-df74" , operation . OperationId ) ;
381
+ Assert . Equal ( "Customers.Customer.MyFunction1.MyFunction2-c53d" , operation1 . OperationId ) ;
382
+ Assert . Equal ( "Customers.Customer.MyFunction1.MyFunction2-4d93" , operation2 . OperationId ) ;
383
+ Assert . Equal ( "Customers.Customer.MyFunction1.MyFunction2-a2b2" , operation3 . OperationId ) ;
384
+ Assert . Equal ( "Customers.Customer.MyFunction1.MyFunction2-7bea" , operation4 . OperationId ) ;
354
385
}
355
386
else
356
387
{
357
- Assert . Null ( operation . OperationId ) ;
388
+ Assert . Null ( operation1 . OperationId ) ;
389
+ Assert . Null ( operation2 . OperationId ) ;
390
+ Assert . Null ( operation3 . OperationId ) ;
391
+ Assert . Null ( operation4 . OperationId ) ;
358
392
}
359
393
}
360
394
0 commit comments