File tree 2 files changed +44
-1
lines changed
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)
117
117
return args ;
118
118
}
119
119
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 )
121
143
{
122
144
return 1 ;
123
145
}
Original file line number Diff line number Diff line change @@ -204,12 +204,33 @@ def test_null_array_conversion():
204
204
r = ob .TestNullArrayConversion (None )
205
205
assert r is None
206
206
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
+
207
223
def test_ienumerable_args ():
208
224
"""Test conversion of python lists and tuples to IEnumerable<object>"""
209
225
ob = MethodTest ()
210
226
x = ob .TestIEnumerable ([1 ,2 ,3 ])
211
227
y = ob .TestIEnumerable ((1 ,2 ,3 ))
212
228
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
+
213
234
def test_string_params_args ():
214
235
"""Test use of string params."""
215
236
result = MethodTest .TestStringParamsArg ('one' , 'two' , 'three' )
You can’t perform that action at this time.
0 commit comments