Skip to content

Commit

Permalink
fixed failing test for boolean in conjunction
Browse files Browse the repository at this point in the history
  • Loading branch information
craiggwilson committed Jun 27, 2010
1 parent 1132b06 commit 63581ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -84,7 +84,7 @@ public void Boolean_In_Conjunction()
{
var people = Enumerable.ToList(Collection.Linq().Where(x => x.PrimaryAddress.IsInternational && x.Age > 21));

Assert.AreEqual(0, people.Count);
Assert.AreEqual(2, people.Count);
}

[Test]
Expand Down
5 changes: 3 additions & 2 deletions source/MongoDB/Linq/Translators/DocumentFormatter.cs
Expand Up @@ -27,7 +27,8 @@ internal Document FormatDocument(Expression expression)
protected override Expression VisitBinary(BinaryExpression b)
{
int scopeDepth = _scopes.Count;
VisitPredicate(b.Left, true);
bool hasPredicate = b.NodeType != ExpressionType.And && b.NodeType != ExpressionType.AndAlso && b.NodeType != ExpressionType.Or && b.NodeType != ExpressionType.OrElse;
VisitPredicate(b.Left, hasPredicate);

switch (b.NodeType)
{
Expand Down Expand Up @@ -57,7 +58,7 @@ protected override Expression VisitBinary(BinaryExpression b)
throw new NotSupportedException(string.Format("The operation {0} is not supported.", b.NodeType));
}

VisitPredicate(b.Right, true);
VisitPredicate(b.Right, false);

while (_scopes.Count > scopeDepth)
PopConditionScope();
Expand Down

0 comments on commit 63581ce

Please sign in to comment.