Skip to content

Commit 7e611e1

Browse files
committed
Add test for nhibernate#1128
1 parent 6c252ee commit 7e611e1

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/NHibernate.Test/Async/Linq/LinqQuerySamples.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,25 @@ join c in db.Customers on
10721072
}
10731073
}
10741074

1075+
[Category("JOIN")]
1076+
[Test(Description = "This sample joins two tables and projects results from the first table.")]
1077+
public async Task DLinqJoin5eAsync()
1078+
{
1079+
var q =
1080+
from c in db.Customers
1081+
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId
1082+
where c.ContactName != null
1083+
select o;
1084+
1085+
using (var sqlSpy = new SqlLogSpy())
1086+
{
1087+
await (ObjectDumper.WriteAsync(q));
1088+
1089+
var sql = sqlSpy.GetWholeLog();
1090+
Assert.That(GetTotalOccurrences(sql, "inner join"), Is.EqualTo(1));
1091+
}
1092+
}
1093+
10751094
[Category("JOIN")]
10761095
[Test(Description = "This sample explictly joins three tables and projects results from each of them.")]
10771096
public async Task DLinqJoin6Async()

src/NHibernate.Test/Linq/LinqQuerySamples.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,25 @@ join c in db.Customers on
16161616
}
16171617
}
16181618

1619+
[Category("JOIN")]
1620+
[Test(Description = "This sample joins two tables and projects results from the first table.")]
1621+
public void DLinqJoin5e()
1622+
{
1623+
var q =
1624+
from c in db.Customers
1625+
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId
1626+
where c.ContactName != null
1627+
select o;
1628+
1629+
using (var sqlSpy = new SqlLogSpy())
1630+
{
1631+
ObjectDumper.Write(q);
1632+
1633+
var sql = sqlSpy.GetWholeLog();
1634+
Assert.That(GetTotalOccurrences(sql, "inner join"), Is.EqualTo(1));
1635+
}
1636+
}
1637+
16191638
[Category("JOIN")]
16201639
[Test(Description = "This sample explictly joins three tables and projects results from each of them.")]
16211640
public void DLinqJoin6()

0 commit comments

Comments
 (0)