示例#1
0
        public void TestCreateLogicalOperator_Or_UnTrimmed()
        {
            //---------------Set up test pack-------------------
            const string operatorString = " or ";

            //---------------Execute Test ----------------------
            Criteria.LogicalOp op = CriteriaParser.CreateLogicalOperator(operatorString);

            //---------------Test Result -----------------------
            Assert.AreEqual(Criteria.LogicalOp.Or, op);
        }
示例#2
0
        public void TestCreateLogicalOperator_VariedCase()
        {
            //---------------Set up test pack-------------------
            const string operatorString = "AnD";

            //---------------Execute Test ----------------------
            Criteria.LogicalOp op = CriteriaParser.CreateLogicalOperator(operatorString);

            //---------------Test Result -----------------------
            Assert.AreEqual(Criteria.LogicalOp.And, op);
        }
示例#3
0
        private static Criteria GetCriteria(CriteriaExpression criteriaExpression)
        {
            Criteria criteria;

            if (criteriaExpression.Left.IsLeaf())//I.e. the left is a prop name.
            {
                criteria = GetCriteriaLeaf(criteriaExpression);
            }
            else
            {
                Criteria           leftCriteria  = GetCriteria(criteriaExpression.Left);
                Criteria           rightCriteria = GetCriteria(criteriaExpression.Right);
                Criteria.LogicalOp logicalOp     = CreateLogicalOperator(criteriaExpression.Expression);
                criteria = new Criteria(leftCriteria, logicalOp, rightCriteria);
            }
            return(criteria);
        }