Skip to content
Browse files

fixed failing test for boolean in conjunction

  • Loading branch information...
1 parent 1132b06 commit 63581cee9783de59fb095e073cf587961c692576 @craiggwilson craiggwilson committed Jun 27, 2010
View
2 source/MongoDB.Tests/IntegrationTests/Linq/MongoQueryTests.cs
@@ -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]
View
5 source/MongoDB/Linq/Translators/DocumentFormatter.cs
@@ -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)
{
@@ -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();

0 comments on commit 63581ce

Please sign in to comment.
Something went wrong with that request. Please try again.