Exemple #1
0
        public void TestCondictionalExpression()
        {
            ExecutionEnvironment e = new ExecutionEnvironment();

            e.RegisterValue("a", true);
            e.RegisterValue("b", false);
            e.RegisterValue("c", 5);
            Identifier a = new Identifier()
            {
                Variable = "a"
            };
            Identifier b = new Identifier()
            {
                Variable = "b"
            };
            Identifier c = new Identifier()
            {
                Variable = "c"
            };
            ConditionalExpression s = new ConditionalExpression()
            {
                Test       = a,
                Consequent = b,
                Alternate  = c
            };
            var c1 = s.Execute(e);

            Assert.AreEqual(c1.ReturnValue, false);
            e.SetValue("a", false);
            var c2 = s.Execute(e);

            Assert.AreEqual(c2.ReturnValue, 5);
        }
        public bool CheckCondition(params object[] exeArgs)
        {
            ConditionalExpression conditionExpr = new ConditionalExpression(ConditionStr);

            return(conditionExpr.Execute(exeArgs));
        }