public void TestLambdaWithPredefinedNameAsParam() { /// This is basically a scope test! :-) Expression <Func <testLambdaSimple, float> > lambdaExpr = t => t.pt / ((float)100.0); CodeContext cc = new CodeContext(); cc.Add("t", Expression.Parameter(typeof(testLambdaSimple), "f**k")); var expr = ParameterReplacementExpressionVisitor.ReplaceParameters(lambdaExpr, cc); Assert.AreEqual(lambdaExpr.ToString(), expr.ToString(), "lambda changed"); Assert.AreEqual("f**k", (cc.GetReplacement("t") as ParameterExpression).Name, "code context was altered"); }
public void TestLambdaWithPredefinedNameAsParam() { /// This is basically a scope test! :-) Expression<Func<testLambdaSimple, float>> lambdaExpr = t => t.pt / ((float)100.0); CodeContext cc = new CodeContext(); cc.Add("t", Expression.Parameter(typeof(testLambdaSimple), "f**k")); var expr = ParameterReplacementExpressionVisitor.ReplaceParameters(lambdaExpr, cc); Assert.AreEqual(lambdaExpr.ToString(), expr.ToString(), "lambda changed"); Assert.AreEqual("f**k", (cc.GetReplacement("t") as ParameterExpression).Name, "code context was altered"); }