Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add SequenceEqual implementation

  • Loading branch information...
commit d4f4d2052c3dd18995a74d97bfccd27bad8daea9 1 parent 87611d8
@testn testn authored
View
9 source/MongoDB.Tests/IntegrationTests/Linq/MongoQueryTests.cs
@@ -201,6 +201,15 @@ public void First()
}
[Test]
+ public void LocalEnumerable_SequenceEqual()
+ {
+ var ids = new[] {1, 2};
+ var people = Collection.Linq().Where(x => x.EmployerIds.SequenceEqual(ids)).ToList();
+
+ Assert.AreEqual(1, people.Count);
+ }
+
+ [Test]
public void LocalEnumerable_Contains()
{
var names = new[] { "Joe", "Bob" };
View
9 source/MongoDB/Linq/Translators/DocumentFormatter.cs
@@ -167,6 +167,15 @@ protected override Expression VisitMethodCall(MethodCallExpression m)
return m;
}
throw new NotSupportedException("The method Count with a predicate is not supported for field.");
+ case "SequenceEqual":
+ field = m.Arguments[0] as FieldExpression;
+ if (field != null)
+ {
+ VisitPredicate(field, true);
+ AddCondition(EvaluateConstant<object>(m.Arguments[1]));
+ PopConditionScope();
+ }
+ return m;
}
}
else if(typeof(ICollection<>).IsOpenTypeAssignableFrom(m.Method.DeclaringType) || typeof(IList).IsAssignableFrom(m.Method.DeclaringType))
Please sign in to comment.
Something went wrong with that request. Please try again.