示例#1
0
        public void TestValidate()
        {
            // Must have exactly 2 subnodes
            try
            {
                _bitWiseNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container));
                Assert.Fail();
            }
            catch (ExprValidationException)
            {
                // Expected
                log.Debug("No nodes in the expression");
            }

            // Must have only number or boolean-type subnodes
            _bitWiseNode.AddChildNode(new SupportExprNode(typeof(string)));
            _bitWiseNode.AddChildNode(new SupportExprNode(typeof(int?)));
            try
            {
                _bitWiseNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container));
                Assert.Fail();
            }
            catch (ExprValidationException)
            {
                // Expected
            }
        }
示例#2
0
        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);
        }