@@ -15,6 +15,26 @@ private class TypedPropertiesClass
15
15
{
16
16
public Decimal decimalValue { get ; set ; }
17
17
public float ? nullableFloat { get ; set ; }
18
+
19
+ public int MethodWithoutParameters ( )
20
+ {
21
+ return 1 ;
22
+ }
23
+
24
+ public int MethodWithOneParameter ( int i )
25
+ {
26
+ return i + 1 ;
27
+ }
28
+
29
+ public string MethodWithMultipleMixedParameters ( int i , string s , bool b )
30
+ {
31
+ return String . Format ( "i: {0}, s: {1}, b: {2}" , i , s , b ) ;
32
+ }
33
+
34
+ public string MethodWithDefaultParameter ( string s = "" )
35
+ {
36
+ return s ;
37
+ }
18
38
}
19
39
20
40
[ TestInitialize ]
@@ -165,5 +185,66 @@ public void SelfReferentialArrayDoesNotCauseStackOverflow()
165
185
{
166
186
_context . Run ( "a = []; a.push(a)" ) ;
167
187
}
188
+
189
+ [ TestMethod ]
190
+ public void MethodCallWithoutParameters ( )
191
+ {
192
+ var obj = new TypedPropertiesClass ( ) ;
193
+ _context . SetParameter ( "obj" , obj ) ;
194
+ var result = _context . Run ( "obj.MethodWithoutParameters()" ) ;
195
+
196
+ result . Should ( ) . Be ( 1 ) ;
197
+ }
198
+
199
+ [ TestMethod ]
200
+ public void MethodCallWithParameter ( )
201
+ {
202
+ var obj = new TypedPropertiesClass ( ) ;
203
+ _context . SetParameter ( "obj" , obj ) ;
204
+ var result = _context . Run ( "obj.MethodWithOneParameter(1)" ) ;
205
+
206
+ result . Should ( ) . Be ( 2 ) ;
207
+ }
208
+
209
+ [ TestMethod ]
210
+ public void MethodCallWithMixedParameter ( )
211
+ {
212
+ var obj = new TypedPropertiesClass ( ) ;
213
+ _context . SetParameter ( "obj" , obj ) ;
214
+ var result = _context . Run ( "obj.MethodWithMultipleMixedParameters(1, 'test', false)" ) ;
215
+
216
+ result . Should ( ) . Be ( "i: 1, s: test, b: False" ) ;
217
+ }
218
+
219
+ [ TestMethod ]
220
+ [ Ignore ]
221
+ public void MethodCallWithDefaultParameter_PassingNoActualParameter ( )
222
+ {
223
+ var obj = new TypedPropertiesClass ( ) ;
224
+ _context . SetParameter ( "obj" , obj ) ;
225
+ var result = _context . Run ( "obj.MethodWithDefaultParameter()" ) ;
226
+
227
+ result . Should ( ) . Be ( "" ) ;
228
+ }
229
+
230
+ [ TestMethod ]
231
+ public void MethodCallWithDefaultParameter_PassingActualParameter ( )
232
+ {
233
+ var obj = new TypedPropertiesClass ( ) ;
234
+ _context . SetParameter ( "obj" , obj ) ;
235
+ var result = _context . Run ( "obj.MethodWithDefaultParameter('foo')" ) ;
236
+
237
+ result . Should ( ) . Be ( "foo" ) ;
238
+ }
239
+
240
+ [ TestMethod ]
241
+ public void MethodCallWithDefaultParameter_PassingExcplicitNullAsActualParameter ( )
242
+ {
243
+ var obj = new TypedPropertiesClass ( ) ;
244
+ _context . SetParameter ( "obj" , obj ) ;
245
+ var result = _context . Run ( "obj.MethodWithDefaultParameter(null)" ) ;
246
+
247
+ result . Should ( ) . Be ( null ) ;
248
+ }
168
249
}
169
250
}
0 commit comments