Permalink
Browse files

Add failing linq extension test.

  • Loading branch information...
1 parent ecf82e4 commit e8b3b745dbbc59ab6378ab4e0b2ab59e086bfbbb unknown committed Aug 11, 2010
Showing with 12 additions and 1 deletion.
  1. +12 −1 source/MongoDB.Tests/IntegrationTests/Linq/LinqExtensionsTests.cs
View
13 source/MongoDB.Tests/IntegrationTests/Linq/LinqExtensionsTests.cs
@@ -16,6 +16,8 @@ private class Person
public int Age { get; set; }
public Address Address { get; set; }
+
+ public string[] Aliases { get; set; }
}
private class Address
@@ -43,7 +45,7 @@ public void TestSetup()
{
personCollection = this.DB.GetCollection<Person>("people");
personCollection.Delete(new { }, true);
- personCollection.Insert(new Person { FirstName = "Bob", LastName = "McBob", Age = 42, Address = new Address { City = "London" } }, true);
+ personCollection.Insert(new Person { FirstName = "Bob", LastName = "McBob", Age = 42, Address = new Address { City = "London" }, Aliases = new[]{"Blub"} }, true);
personCollection.Insert(new Person { FirstName = "Jane", LastName = "McJane", Age = 35, Address = new Address { City = "Paris" } }, true);
personCollection.Insert(new Person { FirstName = "Joe", LastName = "McJoe", Age = 21, Address = new Address { City = "Chicago" } }, true);
@@ -68,5 +70,14 @@ public void Find()
Assert.AreEqual(2, people.Count());
}
+ [Test]
+ public void FindOne_WithAny()
+ {
+ var person = personCollection.FindOne(e => e.Aliases.Any(a=>a=="Blub"));
+
+ Assert.IsNotNull(person);
+ Assert.AreEqual("Bob",person.FirstName);
+ }
+
}
}

0 comments on commit e8b3b74

Please sign in to comment.