public void TestGetType() { log.Debug(".testGetType"); _bitWiseNode = new ExprBitWiseNode(BitWiseOpEnum.BAND); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(double?))); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(int?))); try { _bitWiseNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container)); Assert.Fail(); } catch (ExprValidationException) { // Expected } _bitWiseNode = new ExprBitWiseNode(BitWiseOpEnum.BAND); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(long?))); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(long?))); ExprNodeUtilityValidate.GetValidatedSubtree( ExprNodeOrigin.SELECT, _bitWiseNode, SupportExprValidationContextFactory.MakeEmpty(container)); Assert.AreEqual(typeof(long?), _bitWiseNode.Forge.EvaluationType); }
public void TestToExpressionString() { log.Debug(".testToExpressionString"); _bitWiseNode = new ExprBitWiseNode(BitWiseOpEnum.BAND); _bitWiseNode.AddChildNode(new SupportExprNode(4)); _bitWiseNode.AddChildNode(new SupportExprNode(2)); Assert.AreEqual("4&2", ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(_bitWiseNode)); }
public void TestEvaluate() { log.Debug(".testEvaluate"); _bitWiseNode.AddChildNode(new SupportExprNode(10)); _bitWiseNode.AddChildNode(new SupportExprNode(12)); ExprNodeUtilityValidate.GetValidatedSubtree( ExprNodeOrigin.SELECT, _bitWiseNode, SupportExprValidationContextFactory.MakeEmpty(container)); Assert.AreEqual(8, _bitWiseNode.Forge.ExprEvaluator.Evaluate(null, false, null)); }