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