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); }
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()); }
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()); }
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); }