@@ -16,25 +16,30 @@ private class TypedPropertiesClass
16
16
public Decimal decimalValue { get ; set ; }
17
17
public float ? nullableFloat { get ; set ; }
18
18
19
- public int MethodWithoutParameters ( )
19
+ public int methodWithoutParameters ( )
20
20
{
21
21
return 1 ;
22
22
}
23
23
24
- public int MethodWithOneParameter ( int i )
24
+ public int methodWithOneParameter ( int i )
25
25
{
26
26
return i + 1 ;
27
27
}
28
28
29
- public string MethodWithMultipleMixedParameters ( int i , string s , bool b )
29
+ public string methodWithMultipleMixedParameters ( int i , string s , bool b )
30
30
{
31
31
return String . Format ( "i: {0}, s: {1}, b: {2}" , i , s , b ) ;
32
32
}
33
33
34
- public string MethodWithDefaultParameter ( string s = "" )
34
+ public string methodWithDefaultParameter ( string s = "" )
35
35
{
36
36
return s ;
37
37
}
38
+
39
+ public string methodWithRequiredAndDefaultParameters ( int i , string s = "" , bool b = true )
40
+ {
41
+ return String . Format ( "i: {0}, s: {1}, b: {2}" , i , s , b ) ;
42
+ }
38
43
}
39
44
40
45
[ TestInitialize ]
@@ -191,7 +196,7 @@ public void MethodCallWithoutParameters()
191
196
{
192
197
var obj = new TypedPropertiesClass ( ) ;
193
198
_context . SetParameter ( "obj" , obj ) ;
194
- var result = _context . Run ( "obj.MethodWithoutParameters ()" ) ;
199
+ var result = _context . Run ( "obj.methodWithoutParameters ()" ) ;
195
200
196
201
result . Should ( ) . Be ( 1 ) ;
197
202
}
@@ -201,7 +206,7 @@ public void MethodCallWithParameter()
201
206
{
202
207
var obj = new TypedPropertiesClass ( ) ;
203
208
_context . SetParameter ( "obj" , obj ) ;
204
- var result = _context . Run ( "obj.MethodWithOneParameter (1)" ) ;
209
+ var result = _context . Run ( "obj.methodWithOneParameter (1)" ) ;
205
210
206
211
result . Should ( ) . Be ( 2 ) ;
207
212
}
@@ -211,18 +216,17 @@ public void MethodCallWithMixedParameter()
211
216
{
212
217
var obj = new TypedPropertiesClass ( ) ;
213
218
_context . SetParameter ( "obj" , obj ) ;
214
- var result = _context . Run ( "obj.MethodWithMultipleMixedParameters (1, 'test', false)" ) ;
219
+ var result = _context . Run ( "obj.methodWithMultipleMixedParameters (1, 'test', false)" ) ;
215
220
216
221
result . Should ( ) . Be ( "i: 1, s: test, b: False" ) ;
217
222
}
218
223
219
224
[ TestMethod ]
220
- [ Ignore ]
221
225
public void MethodCallWithDefaultParameter_PassingNoActualParameter ( )
222
226
{
223
227
var obj = new TypedPropertiesClass ( ) ;
224
228
_context . SetParameter ( "obj" , obj ) ;
225
- var result = _context . Run ( "obj.MethodWithDefaultParameter ()" ) ;
229
+ var result = _context . Run ( "obj.methodWithDefaultParameter ()" ) ;
226
230
227
231
result . Should ( ) . Be ( "" ) ;
228
232
}
@@ -232,7 +236,7 @@ public void MethodCallWithDefaultParameter_PassingActualParameter()
232
236
{
233
237
var obj = new TypedPropertiesClass ( ) ;
234
238
_context . SetParameter ( "obj" , obj ) ;
235
- var result = _context . Run ( "obj.MethodWithDefaultParameter ('foo')" ) ;
239
+ var result = _context . Run ( "obj.methodWithDefaultParameter ('foo')" ) ;
236
240
237
241
result . Should ( ) . Be ( "foo" ) ;
238
242
}
@@ -242,9 +246,29 @@ public void MethodCallWithDefaultParameter_PassingExcplicitNullAsActualParameter
242
246
{
243
247
var obj = new TypedPropertiesClass ( ) ;
244
248
_context . SetParameter ( "obj" , obj ) ;
245
- var result = _context . Run ( "obj.MethodWithDefaultParameter (null)" ) ;
249
+ var result = _context . Run ( "obj.methodWithDefaultParameter (null)" ) ;
246
250
247
251
result . Should ( ) . Be ( null ) ;
248
252
}
253
+
254
+ [ TestMethod ]
255
+ public void MethodCallWithRequiredAndDefaultParameters_PassingNoOptionalActualParameter ( )
256
+ {
257
+ var obj = new TypedPropertiesClass ( ) ;
258
+ _context . SetParameter ( "obj" , obj ) ;
259
+ var result = _context . Run ( "obj.methodWithRequiredAndDefaultParameters(1)" ) ;
260
+
261
+ result . Should ( ) . Be ( "i: 1, s: , b: True" ) ;
262
+ }
263
+
264
+ [ TestMethod ]
265
+ public void MethodCallWithRequiredAndDefaultParameters_PassingAllActualParameter ( )
266
+ {
267
+ var obj = new TypedPropertiesClass ( ) ;
268
+ _context . SetParameter ( "obj" , obj ) ;
269
+ var result = _context . Run ( "obj.methodWithRequiredAndDefaultParameters(1, 'test', false)" ) ;
270
+
271
+ result . Should ( ) . Be ( "i: 1, s: test, b: False" ) ;
272
+ }
249
273
}
250
274
}
0 commit comments