protected void AssertQuery(bool successful, object element, bool withContains) { IQuery q = NewQuery(_helper.ItemType); IConstraint constraint = q.Descend(GenericCollectionTestFactory.FieldName).Constrain(element); if (withContains) { constraint.Contains(); } AssertQueryResult(q, successful); }
protected virtual void AssertQuery(bool successful, object element, bool withContains ) { IQuery q = NewQuery(ItemFactory().ItemClass()); IConstraint constraint = q.Descend(ItemFactory().FieldName()).Constrain(element); if (withContains) { constraint.Contains(); } AssertQueryResult(q, successful); }
public virtual void Visit(ComparisonExpression expression) { IQuery subQuery = Descend(expression.Left()); ComparisonQueryGeneratingVisitor visitor = new ComparisonQueryGeneratingVisitor(_predicate , _classSource, _referenceResolver); expression.Right().Accept(visitor); _constraint = subQuery.Constrain(visitor.Value()); ComparisonOperator op = expression.Op(); if (op.Equals(ComparisonOperator.ValueEquality)) { return; } if (op.Equals(ComparisonOperator.ReferenceEquality)) { _constraint.Identity(); return; } if (op.Equals(ComparisonOperator.Greater)) { _constraint.Greater(); return; } if (op.Equals(ComparisonOperator.Smaller)) { _constraint.Smaller(); return; } if (op.Equals(ComparisonOperator.Contains)) { _constraint.Contains(); return; } if (op.Equals(ComparisonOperator.StartsWith)) { _constraint.StartsWith(true); return; } if (op.Equals(ComparisonOperator.EndsWith)) { _constraint.EndsWith(true); return; } throw new Exception("Can't handle constraint: " + op); }
public void Modify(IConstraint constraint) { constraint.Contains(); }