44// ------------------------------------------------------------
55
66using System ;
7- using System . Runtime . CompilerServices ;
87using Microsoft . OData . Edm ;
98using Xunit ;
109
@@ -74,17 +73,18 @@ public void GetPathItemNameReturnsCorrectActionLiteral(bool unqualifiedCall, boo
7473 }
7574
7675 [ Theory ]
77- [ InlineData ( true , true , "MyFunction(param={param})" ) ]
78- [ InlineData ( true , false , "MyFunction(entity={entity},param={param})" ) ]
79- [ InlineData ( false , true , "NS.MyFunction(param={param})" ) ]
80- [ InlineData ( false , false , "NS.MyFunction(entity={entity},param={param})" ) ]
76+ [ InlineData ( true , true , "MyFunction(param={param},param2=@param2 )" ) ]
77+ [ InlineData ( true , false , "MyFunction(entity={entity},param={param},param2=@param2 )" ) ]
78+ [ InlineData ( false , true , "NS.MyFunction(param={param},param2=@param2 )" ) ]
79+ [ InlineData ( false , false , "NS.MyFunction(entity={entity},param={param},param2=@param2 )" ) ]
8180 public void GetPathItemNameReturnsCorrectFunctionLiteral ( bool unqualifiedCall , bool isBound , string expected )
8281 {
8382 // Arrange & Act
8483 IEdmEntityTypeReference entityTypeReference = new EdmEntityTypeReference ( new EdmEntityType ( "NS" , "Entity" ) , false ) ;
8584 IEdmTypeReference parameterType = EdmCoreModel . Instance . GetPrimitive ( EdmPrimitiveTypeKind . Boolean , isNullable : false ) ;
8685 EdmFunction boundFunction = BoundFunction ( "MyFunction" , isBound , entityTypeReference ) ;
8786 boundFunction . AddParameter ( "param" , parameterType ) ;
87+ boundFunction . AddOptionalParameter ( "param2" , parameterType ) ;
8888
8989 var segment = new ODataOperationSegment ( boundFunction ) ;
9090 OpenApiConvertSettings settings = new OpenApiConvertSettings
@@ -97,17 +97,18 @@ public void GetPathItemNameReturnsCorrectFunctionLiteral(bool unqualifiedCall, b
9797 }
9898
9999 [ Theory ]
100- [ InlineData ( true , true , "{param }" ) ]
101- [ InlineData ( true , false , "NS.MyFunction(param='{param}')" ) ]
102- [ InlineData ( false , true , "NS.MyFunction(param='{param}')" ) ]
103- [ InlineData ( false , false , "NS.MyFunction(param='{param}')" ) ]
100+ [ InlineData ( true , true , "{param2 }" ) ]
101+ [ InlineData ( true , false , "NS.MyFunction(param='{param}',param2='@param2' )" ) ]
102+ [ InlineData ( false , true , "NS.MyFunction(param='{param}',param2='@param2' )" ) ]
103+ [ InlineData ( false , false , "NS.MyFunction(param='{param}',param2='@param2' )" ) ]
104104 public void GetPathItemNameReturnsCorrectFunctionLiteralForEscapedFunction ( bool isEscapedFunction , bool enableEscapeFunctionCall , string expected )
105105 {
106106 // Arrange & Act
107107 IEdmEntityTypeReference entityTypeReference = new EdmEntityTypeReference ( new EdmEntityType ( "NS" , "Entity" ) , false ) ;
108108 IEdmTypeReference parameterType = EdmCoreModel . Instance . GetPrimitive ( EdmPrimitiveTypeKind . String , isNullable : false ) ;
109109 EdmFunction boundFunction = BoundFunction ( "MyFunction" , true , entityTypeReference ) ;
110110 boundFunction . AddParameter ( "param" , parameterType ) ;
111+ boundFunction . AddOptionalParameter ( "param2" , parameterType ) ;
111112
112113 var segment = new ODataOperationSegment ( boundFunction , isEscapedFunction ) ;
113114 OpenApiConvertSettings settings = new OpenApiConvertSettings
@@ -121,17 +122,18 @@ public void GetPathItemNameReturnsCorrectFunctionLiteralForEscapedFunction(bool
121122 }
122123
123124 [ Theory ]
124- [ InlineData ( true , true , "{param }:" ) ]
125- [ InlineData ( true , false , "NS.MyFunction(param='{param}')" ) ]
126- [ InlineData ( false , true , "NS.MyFunction(param='{param}')" ) ]
127- [ InlineData ( false , false , "NS.MyFunction(param='{param}')" ) ]
125+ [ InlineData ( true , true , "{param2 }:" ) ]
126+ [ InlineData ( true , false , "NS.MyFunction(param='{param}',param2='@param2' )" ) ]
127+ [ InlineData ( false , true , "NS.MyFunction(param='{param}',param2='@param2' )" ) ]
128+ [ InlineData ( false , false , "NS.MyFunction(param='{param}',param2='@param2' )" ) ]
128129 public void GetPathItemNameReturnsCorrectFunctionLiteralForEscapedComposableFunction ( bool isEscapedFunction , bool enableEscapeFunctionCall , string expected )
129130 {
130131 // Arrange & Act
131132 IEdmEntityTypeReference entityTypeReference = new EdmEntityTypeReference ( new EdmEntityType ( "NS" , "Entity" ) , false ) ;
132133 IEdmTypeReference parameterType = EdmCoreModel . Instance . GetPrimitive ( EdmPrimitiveTypeKind . String , isNullable : false ) ;
133134 EdmFunction boundFunction = BoundFunction ( "MyFunction" , true , entityTypeReference , true ) ;
134135 boundFunction . AddParameter ( "param" , parameterType ) ;
136+ boundFunction . AddOptionalParameter ( "param2" , parameterType ) ;
135137
136138 var segment = new ODataOperationSegment ( boundFunction , isEscapedFunction ) ;
137139 OpenApiConvertSettings settings = new OpenApiConvertSettings
0 commit comments