Skip to content

Commit

Permalink
Add failing linq test where a child object is null when the object is…
Browse files Browse the repository at this point in the history
… used with a complex local projection.
  • Loading branch information
lanwin committed May 31, 2010
1 parent e291beb commit 7f32fb7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/MongoDB.Tests/IntegrationTests/Linq/LinqDomain.cs
Expand Up @@ -43,4 +43,16 @@ public enum AddressType
Company,
Private
}

public class PersonWrapper
{
public Person Person { get; set; }
public string Name { get; set; }

public PersonWrapper(Person person, string name)
{
Person = person;
Name = name;
}
}
}
13 changes: 13 additions & 0 deletions source/MongoDB.Tests/IntegrationTests/Linq/MongoQueryTests.cs
Expand Up @@ -313,6 +313,19 @@ public void Projection()
Assert.AreEqual(3, people.Count);
}

[Test]
public void ProjectionWithLocalCreation_ChildobjectShouldNotBeNull()
{
var people = Collection.Linq()
.Select(p => new PersonWrapper(p, p.FirstName))
.FirstOrDefault();

Assert.IsNotNull(people);
Assert.IsNotNull(people.Name);
Assert.IsNotNull(people.Person);
Assert.IsNotNull(people.Person.PrimaryAddress);
}

[Test]
public void ProjectionWithConstraints()
{
Expand Down

0 comments on commit 7f32fb7

Please sign in to comment.