Beispiel #1
0
        private ExprEqualsNode MakeNode(Object valueLeft, Type typeLeft, Object valueRight, Type typeRight, bool isNot)
        {
            ExprEqualsNode equalsNode = new ExprEqualsNodeImpl(isNot, false);

            equalsNode.AddChildNode(new SupportExprNode(valueLeft, typeLeft));
            equalsNode.AddChildNode(new SupportExprNode(valueRight, typeRight));
            SupportExprNodeUtil.Validate(equalsNode);
            return(equalsNode);
        }
Beispiel #2
0
        private ExprMathNode MakeNode(Object valueLeft, Type typeLeft, Object valueRight, Type typeRight)
        {
            ExprMathNode mathNode = new ExprMathNode(MathArithTypeEnum.MULTIPLY, false, false);

            mathNode.AddChildNode(new SupportExprNode(valueLeft, typeLeft));
            mathNode.AddChildNode(new SupportExprNode(valueRight, typeRight));
            SupportExprNodeUtil.Validate(mathNode);
            return(mathNode);
        }
        private ExprRelationalOpNode MakeNode(Object valueLeft, Type typeLeft, Object valueRight, Type typeRight)
        {
            ExprRelationalOpNode relOpNode = new ExprRelationalOpNodeImpl(RelationalOpEnum.GE);

            relOpNode.AddChildNode(new SupportExprNode(valueLeft, typeLeft));
            relOpNode.AddChildNode(new SupportExprNode(valueRight, typeRight));
            SupportExprNodeUtil.Validate(relOpNode);
            return(relOpNode);
        }
Beispiel #4
0
        public void TestEvaluate()
        {
            notNode.AddChildNode(new SupportBoolExprNode(true));
            SupportExprNodeUtil.Validate(container, notNode);
            Assert.IsFalse((bool)notNode.Evaluate(null, false, null));

            notNode = new ExprNotNode();
            notNode.AddChildNode(new SupportBoolExprNode(false));
            SupportExprNodeUtil.Validate(container, notNode);
            Assert.IsTrue((bool)notNode.Evaluate(null, false, null));
        }
Beispiel #5
0
     public void TestEvaluate()
     {
         _notNode.AddChildNode(new SupportBoolExprNode(true));
         SupportExprNodeUtil.Validate(_notNode);
         Assert.IsFalse(_notNode.Evaluate(new EvaluateParams(null, false, null)).AsBoolean());
 
         _notNode = new ExprNotNode();
         _notNode.AddChildNode(new SupportBoolExprNode(false));
         SupportExprNodeUtil.Validate(_notNode);
         Assert.IsTrue(_notNode.Evaluate(new EvaluateParams(null, false, null)).AsBoolean());
     }
Beispiel #6
0
        public void TestEvaluate()
        {
            _concatNode.AddChildNode(new SupportExprNode("x"));
            _concatNode.AddChildNode(new SupportExprNode("y"));
            SupportExprNodeUtil.Validate(_concatNode);
            Assert.AreEqual(typeof(string), _concatNode.ExprEvaluator.ReturnType);
            Assert.AreEqual("xy", _concatNode.ExprEvaluator.Evaluate(EvaluateParams.Empty));

            _concatNode.AddChildNode(new SupportExprNode("z"));
            SupportExprNodeUtil.Validate(_concatNode);
            Assert.AreEqual("xyz", _concatNode.ExprEvaluator.Evaluate(EvaluateParams.Empty));
        }
Beispiel #7
0
        public void TestEvaluate()
        {
            concatNode.AddChildNode(new SupportExprNode("x"));
            concatNode.AddChildNode(new SupportExprNode("y"));
            SupportExprNodeUtil.Validate(container, concatNode);
            Assert.AreEqual(typeof(string), concatNode.Forge.EvaluationType);
            Assert.AreEqual("xy", concatNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            concatNode.AddChildNode(new SupportExprNode("z"));
            SupportExprNodeUtil.Validate(container, concatNode);
            Assert.AreEqual("xyz", concatNode.Forge.ExprEvaluator.Evaluate(null, false, null));
        }
Beispiel #8
0
        public void TestEvaluate()
        {
            andNode.AddChildNode(new SupportBoolExprNode(true));
            andNode.AddChildNode(new SupportBoolExprNode(true));
            SupportExprNodeUtil.Validate(container, andNode);
            Assert.IsTrue((bool)andNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            andNode = new ExprAndNodeImpl();
            andNode.AddChildNode(new SupportBoolExprNode(true));
            andNode.AddChildNode(new SupportBoolExprNode(false));
            SupportExprNodeUtil.Validate(container, andNode);
            Assert.IsFalse((bool)andNode.Forge.ExprEvaluator.Evaluate(null, false, null));
        }
Beispiel #9
0
        public void TestEvaluate()
        {
            orNode.AddChildNode(new SupportBoolExprNode(true));
            orNode.AddChildNode(new SupportBoolExprNode(false));
            SupportExprNodeUtil.Validate(container, orNode);
            Assert.IsTrue((bool)orNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            orNode = new ExprOrNode();
            orNode.AddChildNode(new SupportBoolExprNode(false));
            orNode.AddChildNode(new SupportBoolExprNode(false));
            SupportExprNodeUtil.Validate(container, orNode);
            Assert.IsFalse((bool)orNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            orNode = new ExprOrNode();
            orNode.AddChildNode(new SupportExprNode(null, typeof(bool?)));
            orNode.AddChildNode(new SupportExprNode(false));
            SupportExprNodeUtil.Validate(container, orNode);
            Assert.IsNull(orNode.Forge.ExprEvaluator.Evaluate(null, false, null));
        }