@@ -2285,5 +2285,91 @@ public void MethodWithOutParameterInlineVarDeclaration()
22852285 }
22862286
22872287 #endregion
2288+
2289+ #region Method with ref parameter
2290+
2291+ [ Test ]
2292+ [ Category ( "RefKeywordMethod" ) ]
2293+ public void MethodWithRefParameter ( )
2294+ {
2295+ ExpressionEvaluator evaluator = new ExpressionEvaluator ( ) ;
2296+
2297+ evaluator . Variables [ "refObj" ] = new MethodArgKeywordClass ( ) ;
2298+
2299+ evaluator . Variables [ "x" ] = 3 ;
2300+
2301+ evaluator . Evaluate ( "refObj.AddOneOnRef(ref x)" ) ;
2302+
2303+ evaluator . Variables . ShouldContainKey ( "x" ) ;
2304+ evaluator . Variables [ "x" ]
2305+ . ShouldBeOfType < int > ( )
2306+ . ShouldBe ( 4 ) ;
2307+ }
2308+
2309+ [ Test ]
2310+ [ Category ( "RefKeywordMethod" ) ]
2311+ public void MethodWithRefParameterWithoutExistingVariable ( )
2312+ {
2313+ ExpressionEvaluator evaluator = new ExpressionEvaluator ( ) ;
2314+
2315+ evaluator . Variables [ "refObj" ] = new MethodArgKeywordClass ( ) ;
2316+
2317+ evaluator . Evaluate ( "refObj.AddOneOnRef(ref x)" ) ;
2318+
2319+ evaluator . Variables . ShouldContainKey ( "x" ) ;
2320+ evaluator . Variables [ "x" ]
2321+ . ShouldBeOfType < int > ( )
2322+ . ShouldBe ( 1 ) ;
2323+ }
2324+
2325+ [ Test ]
2326+ [ Category ( "RefKeywordMethod" ) ]
2327+ public void MethodWithRefParameterInlineVarDeclaration ( )
2328+ {
2329+ ExpressionEvaluator evaluator = new ExpressionEvaluator ( ) ;
2330+
2331+ evaluator . Variables [ "refObj" ] = new MethodArgKeywordClass ( ) ;
2332+
2333+ evaluator . Evaluate ( "refObj.AddOneOnRef(ref int x)" ) ;
2334+
2335+ evaluator . Variables . ShouldContainKey ( "x" ) ;
2336+ evaluator . Variables [ "x" ]
2337+ . ShouldBeOfType < StronglyTypedVariable > ( )
2338+ . Value . ShouldBe ( 1 ) ;
2339+ }
2340+
2341+ [ Test ]
2342+ [ Category ( "RefKeywordMethod" ) ]
2343+ public void MethodWithRefParameterWithoutExistingVariableAndInit ( )
2344+ {
2345+ ExpressionEvaluator evaluator = new ExpressionEvaluator ( ) ;
2346+
2347+ evaluator . Variables [ "refObj" ] = new MethodArgKeywordClass ( ) ;
2348+
2349+ evaluator . Evaluate ( "refObj.AddOneOnRef(ref x = 4)" ) ;
2350+
2351+ evaluator . Variables . ShouldContainKey ( "x" ) ;
2352+ evaluator . Variables [ "x" ]
2353+ . ShouldBeOfType < int > ( )
2354+ . ShouldBe ( 5 ) ;
2355+ }
2356+
2357+ [ Test ]
2358+ [ Category ( "RefKeywordMethod" ) ]
2359+ public void MethodWithRefParameterInlineVarDeclarationAndInit ( )
2360+ {
2361+ ExpressionEvaluator evaluator = new ExpressionEvaluator ( ) ;
2362+
2363+ evaluator . Variables [ "refObj" ] = new MethodArgKeywordClass ( ) ;
2364+
2365+ evaluator . Evaluate ( "refObj.AddOneOnRef(ref int x = 6)" ) ;
2366+
2367+ evaluator . Variables . ShouldContainKey ( "x" ) ;
2368+ evaluator . Variables [ "x" ]
2369+ . ShouldBeOfType < StronglyTypedVariable > ( )
2370+ . Value . ShouldBe ( 7 ) ;
2371+ }
2372+
2373+ #endregion
22882374 }
22892375}
0 commit comments