Skip to content

Commit b17820a

Browse files
committed
Add test for #1128
1 parent 000137a commit b17820a

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
@@ -1022,6 +1022,25 @@ from c in db.Customers
10221022
}
10231023
}
10241024

1025+
[Category("JOIN")]
1026+
[Test(Description = "This sample joins two tables and projects results from the first table.")]
1027+
public async Task DLinqJoin5eAsync()
1028+
{
1029+
var q =
1030+
from c in db.Customers
1031+
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId
1032+
where c.ContactName != null
1033+
select o;
1034+
1035+
using (var sqlSpy = new SqlLogSpy())
1036+
{
1037+
await (ObjectDumper.WriteAsync(q));
1038+
1039+
var sql = sqlSpy.GetWholeLog();
1040+
Assert.That(GetTotalOccurrences(sql, "inner join"), Is.EqualTo(1));
1041+
}
1042+
}
1043+
10251044
[Category("JOIN")]
10261045
[Test(Description = "This sample explictly joins three tables and projects results from each of them.")]
10271046
public async Task DLinqJoin6Async()

src/NHibernate.Test/Linq/LinqQuerySamples.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,25 @@ from c in db.Customers
15661566
}
15671567
}
15681568

1569+
[Category("JOIN")]
1570+
[Test(Description = "This sample joins two tables and projects results from the first table.")]
1571+
public void DLinqJoin5e()
1572+
{
1573+
var q =
1574+
from c in db.Customers
1575+
join o in db.Orders on c.CustomerId equals o.Customer.CustomerId
1576+
where c.ContactName != null
1577+
select o;
1578+
1579+
using (var sqlSpy = new SqlLogSpy())
1580+
{
1581+
ObjectDumper.Write(q);
1582+
1583+
var sql = sqlSpy.GetWholeLog();
1584+
Assert.That(GetTotalOccurrences(sql, "inner join"), Is.EqualTo(1));
1585+
}
1586+
}
1587+
15691588
[Category("JOIN")]
15701589
[Test(Description = "This sample explictly joins three tables and projects results from each of them.")]
15711590
public void DLinqJoin6()

0 commit comments

Comments
 (0)