@@ -25,7 +25,7 @@ public async Task Generate_EndToEnd()
2525 ConstructorInfo ctorInfo = typeof ( TimerTriggerAttribute ) . GetConstructor ( new Type [ ] { typeof ( string ) } ) ;
2626 PropertyInfo runOnStartupProperty = typeof ( TimerTriggerAttribute ) . GetProperty ( "RunOnStartup" ) ;
2727 CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder (
28- ctorInfo ,
28+ ctorInfo ,
2929 new object [ ] { "00:00:02" } ,
3030 new PropertyInfo [ ] { runOnStartupProperty } ,
3131 new object [ ] { true } ) ;
@@ -63,5 +63,42 @@ public async Task Generate_EndToEnd()
6363 // verify our custom invoker was called
6464 Assert . True ( invoker . InvokeCount >= 2 ) ;
6565 }
66+
67+ [ Fact ]
68+ public void Generate_WithMultipleOutParameters ( )
69+ {
70+ string functionName = "FunctionWithOuts" ;
71+ Collection < ParameterDescriptor > parameters = new Collection < ParameterDescriptor > ( ) ;
72+
73+ parameters . Add ( new ParameterDescriptor ( "param1" , typeof ( string ) ) ) ;
74+ parameters . Add ( new ParameterDescriptor ( "param2" , typeof ( string ) . MakeByRefType ( ) ) { Attributes = ParameterAttributes . Out } ) ;
75+ parameters . Add ( new ParameterDescriptor ( "param3" , typeof ( string ) . MakeByRefType ( ) ) { Attributes = ParameterAttributes . Out } ) ;
76+
77+ FunctionMetadata metadata = new FunctionMetadata ( ) ;
78+ TestInvoker invoker = new TestInvoker ( ) ;
79+ FunctionDescriptor function = new FunctionDescriptor ( functionName , invoker , metadata , parameters ) ;
80+ Collection < FunctionDescriptor > functions = new Collection < FunctionDescriptor > ( ) ;
81+ functions . Add ( function ) ;
82+
83+ // generate the Type
84+ Type functionType = FunctionGenerator . Generate ( "TestScriptHost" , "TestFunctions" , functions ) ;
85+
86+ // verify the generated function
87+ MethodInfo method = functionType . GetMethod ( functionName ) ;
88+ ParameterInfo [ ] functionParams = method . GetParameters ( ) ;
89+
90+ // Verify that we have the correct number of parameters
91+ Assert . Equal ( parameters . Count , functionParams . Length ) ;
92+
93+ // Verify that out parameters were correctly generated
94+ Assert . True ( functionParams [ 1 ] . IsOut ) ;
95+ Assert . True ( functionParams [ 2 ] . IsOut ) ;
96+
97+ // Verify that the method is invocable
98+ method . Invoke ( null , new object [ ] { "test" , null , null } ) ;
99+
100+ // verify our custom invoker was called
101+ Assert . Equal ( 1 , invoker . InvokeCount ) ;
102+ }
66103 }
67104}
0 commit comments