AjScript.Tests.Language.FunctionTests.EvaluateWithThisObject C# (CSharp) Method

EvaluateWithThisObject() private method

private EvaluateWithThisObject ( ) : void
return void
        public void EvaluateWithThisObject()
        {
            Context context = new Context();
            ICommand body = new ReturnCommand(new ArithmeticBinaryExpression(ArithmeticOperator.Add, new VariableExpression("x"), new DotExpression(new VariableExpression("this"), "Age")));
            Function function = new Function(new string[] { "x" }, body);
            DynamicObject person = new DynamicObject();
            person.SetValue("Age", 30);

            Assert.AreEqual(40, function.Invoke(context, person, new object[] { 10 }));
        }