File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,29 @@ public static int[] TestOverloadedParams(int v, int[] args)
117117 return args ;
118118 }
119119
120- public static int TestIEnumerable ( System . Collections . Generic . IEnumerable < object > arg )
120+ public static int TestIList ( System . Collections . Generic . IList < object > arg )
121+ {
122+ return 1 ;
123+ }
124+
125+ public static int TestICollection ( System . Collections . Generic . ICollection < object > arg )
126+ {
127+ return 1 ;
128+ }
129+
130+ public int TestAction ( System . Action action )
131+ {
132+ action ( ) ;
133+ return 1 ;
134+ }
135+
136+ public int TestTask ( System . Threading . Tasks . Task < int > task )
137+ {
138+ task . RunSynchronously ( ) ;
139+ return task . Result ;
140+ }
141+
142+ public int TestIEnumerable ( System . Collections . Generic . IEnumerable < object > arg )
121143 {
122144 return 1 ;
123145 }
Original file line number Diff line number Diff line change @@ -204,12 +204,33 @@ def test_null_array_conversion():
204204 r = ob .TestNullArrayConversion (None )
205205 assert r is None
206206
207+ def test_action ():
208+ """Test python lambda as an action"""
209+ ob = MethodTest ()
210+ def func ():
211+ return
212+ r = ob .TestAction (func )
213+ assert r == 1
214+
215+ def test_task ():
216+ """Test python lambda as an action"""
217+ ob = MethodTest ()
218+ def func ():
219+ return 1
220+ r = ob .TestTask (func )
221+ assert r == 1
222+
207223def test_ienumerable_args ():
208224 """Test conversion of python lists and tuples to IEnumerable<object>"""
209225 ob = MethodTest ()
210226 x = ob .TestIEnumerable ([1 ,2 ,3 ])
211227 y = ob .TestIEnumerable ((1 ,2 ,3 ))
212228
229+ def test_icollection_args ():
230+ """Test conversion of python lists and tuples to ICollection<object>"""
231+ ob = MethodTest ()
232+ x = ob .TestICollection ([1 ,2 ,3 ])
233+
213234def test_string_params_args ():
214235 """Test use of string params."""
215236 result = MethodTest .TestStringParamsArg ('one' , 'two' , 'three' )
You can’t perform that action at this time.
0 commit comments