Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void TestToExpressionString()
        {
            // Build sum(4-2)
            var arithNodeChild = new ExprMathNode(MathArithTypeEnum.SUBTRACT, false, false);

            arithNodeChild.AddChildNode(new SupportExprNode(4));
            arithNodeChild.AddChildNode(new SupportExprNode(2));

            _sumNode = new ExprSumNode(false);
            _sumNode.AddChildNode(arithNodeChild);

            Assert.AreEqual("sum(4-2)", _sumNode.ToExpressionStringMinPrecedenceSafe());
        }
Ejemplo n.º 3
0
        public void TestToExpressionString()
        {
            // Build (5*(4-2)), not the same as 5*4-2
            ExprMathNode arithNodeChild = new ExprMathNode(MathArithTypeEnum.SUBTRACT, false, false);

            arithNodeChild.AddChildNode(new SupportExprNode(4));
            arithNodeChild.AddChildNode(new SupportExprNode(2));

            _arithNode = new ExprMathNode(MathArithTypeEnum.MULTIPLY, false, false);
            _arithNode.AddChildNode(new SupportExprNode(5));
            _arithNode.AddChildNode(arithNodeChild);

            Assert.AreEqual("5*(4-2)", _arithNode.ToExpressionStringMinPrecedenceSafe());
        }
Ejemplo n.º 4
0
 public void TestGetType()
 {
     _arithNode.AddChildNode(new SupportExprNode(typeof(double?)));
     _arithNode.AddChildNode(new SupportExprNode(typeof(int)));
     _arithNode.Validate(SupportExprValidationContextFactory.MakeEmpty(_container));
     Assert.AreEqual(typeof(double?), _arithNode.ReturnType);
 }