Skip to content

Commit

Permalink
Added test to reproduce #38.
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-tkachev committed Apr 2, 2014
1 parent d43a871 commit 39e6ec0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Tests/Linq/Linq/IssueTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Diagnostics;
using System.Linq;

using NUnit.Framework;

using Tests.Model;

namespace Tests.Linq
{
[TestFixture]
public class IssueTests : TestBase
{
[Test, DataContextSource(false)]
public void Issue38Test(string context)
{
using (var db = GetDataContext(context))
{
AreEqual(
from a in Child
select new { Count = a.GrandChildren.Count() },
from a in db.Child
select new { Count = a.GrandChildren1.Count() });

var sql = ((TestDataConnection)db).LastQuery;

Assert.That(sql, Is.Not.Contains("INNER JOIN"));

Debug.WriteLine(sql);
}
}
}
}
1 change: 1 addition & 0 deletions Tests/Linq/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
<Compile Include="DDL\CreateTableTest.cs" />
<Compile Include="Linq\AsyncTest.cs" />
<Compile Include="Linq\ColumnAliasTest.cs" />
<Compile Include="Linq\IssueTests.cs" />
<Compile Include="Linq\LoadWithTest.cs" />
<Compile Include="Linq\EnumMapping.cs" />
<Compile Include="Linq\ExplicitInterfaceTest.cs" />
Expand Down
3 changes: 3 additions & 0 deletions Tests/Model/ParentChild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public class Child
[Association(ThisKey = "ParentID, ChildID", OtherKey = "ParentID, ChildID")]
public List<GrandChild> GrandChildren;

[Association(ThisKey = "ParentID, ChildID", OtherKey = "ParentID, ChildID", CanBeNull = false)]
public List<GrandChild> GrandChildren1;

public override bool Equals(object obj)
{
return Equals(obj as Child);
Expand Down

0 comments on commit 39e6ec0

Please sign in to comment.