public void UseMostSpecificOverride()
        {
            PropertyOrFieldNode pofNode = new PropertyOrFieldNode();
            pofNode.Text = "StringProp";

            Assert.AreEqual(new DateTime(2008,1,1), ((IExpression) pofNode).GetValue(new DerivedClass()));
        }
Ejemplo n.º 2
0
        public void UseMostSpecificOverride()
        {
            PropertyOrFieldNode pofNode = new PropertyOrFieldNode();

            pofNode.Text = "StringProp";

            Assert.AreEqual(new DateTime(2008, 1, 1), ((IExpression)pofNode).GetValue(new DerivedClass()));
        }
Ejemplo n.º 3
0
        public void PerformanceOfMethodEvaluationOnDifferentContextTypes()
        {
            MethodNode mn = new MethodNode();

            mn.Text = "ToString";

            TypeNode nln = new TypeNode();

            nln.Text = "System.Globalization.CultureInfo";

            PropertyOrFieldNode pn = new PropertyOrFieldNode();

            pn.Text = "InvariantCulture";


            Expression exp = new Expression();

            exp.addChild(nln);
            exp.addChild(pn);

            StringLiteralNode sln = new StringLiteralNode();

            sln.Text = "dummy";

            mn.addChild(sln);
            mn.addChild(exp);

            IExpression mnExp = mn;

            Assert.AreEqual("dummy", mnExp.GetValue(0m, null));

            int runs = 10000000;

            StopWatch watch = new StopWatch();

            using (watch.Start("Duration: {0}"))
            {
                for (int i = 0; i < runs; i++)
                {
                    mnExp.GetValue(0m, null);
                }
            }
        }