Skip to content

Commit e1329d5

Browse files
committed
Comment Linq to Objects query
1 parent 362344c commit e1329d5

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,24 +1285,24 @@ public async Task DLinqJoin9LeftJoinAsync(bool useCrossJoin)
12851285
Assert.Ignore("Dialect does not support cross join.");
12861286
}
12871287

1288-
ICollection expected, actual;
1289-
expected =
1290-
(from o in db.Orders.ToList()
1291-
from p in db.Products.ToList()
1292-
join d in db.OrderLines.ToList()
1293-
on new {o.OrderId, p.ProductId} equals new {d.Order.OrderId, d.Product.ProductId}
1294-
into details
1295-
from d in details.DefaultIfEmpty()
1296-
where d != null && d.UnitPrice > 50
1297-
select new {o.OrderId, p.ProductId, d.UnitPrice}).ToList();
1288+
// The expected collection can be obtained from the below Linq to Objects query.
1289+
//var expected =
1290+
// (from o in db.Orders.ToList()
1291+
// from p in db.Products.ToList()
1292+
// join d in db.OrderLines.ToList()
1293+
// on new { o.OrderId, p.ProductId } equals new { d.Order.OrderId, d.Product.ProductId }
1294+
// into details
1295+
// from d in details.DefaultIfEmpty()
1296+
// where d != null && d.UnitPrice > 50
1297+
// select new { o.OrderId, p.ProductId, d.UnitPrice }).ToList();
12981298

12991299
using (var substitute = SubstituteDialect())
13001300
using (var sqlSpy = new SqlLogSpy())
13011301
{
13021302
ClearQueryPlanCache();
13031303
substitute.Value.SupportsCrossJoin.Returns(useCrossJoin);
13041304

1305-
actual =
1305+
var actual =
13061306
await ((from o in db.Orders
13071307
from p in db.Products
13081308
join d in db.OrderLines
@@ -1313,11 +1313,10 @@ from d in details.DefaultIfEmpty()
13131313
select new {o.OrderId, p.ProductId, d.UnitPrice}).ToListAsync());
13141314

13151315
var sql = sqlSpy.GetWholeLog();
1316+
Assert.That(actual.Count, Is.EqualTo(163));
13161317
Assert.That(sql, Does.Contain(useCrossJoin ? "cross join" : "inner join"));
13171318
Assert.That(GetTotalOccurrences(sql, "left outer join"), Is.EqualTo(1));
13181319
}
1319-
1320-
Assert.AreEqual(expected.Count, actual.Count);
13211320
}
13221321

13231322
[Category("JOIN")]

src/NHibernate.Test/Linq/LinqQuerySamples.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,24 +1829,24 @@ public void DLinqJoin9LeftJoin(bool useCrossJoin)
18291829
Assert.Ignore("Dialect does not support cross join.");
18301830
}
18311831

1832-
ICollection expected, actual;
1833-
expected =
1834-
(from o in db.Orders.ToList()
1835-
from p in db.Products.ToList()
1836-
join d in db.OrderLines.ToList()
1837-
on new {o.OrderId, p.ProductId} equals new {d.Order.OrderId, d.Product.ProductId}
1838-
into details
1839-
from d in details.DefaultIfEmpty()
1840-
where d != null && d.UnitPrice > 50
1841-
select new {o.OrderId, p.ProductId, d.UnitPrice}).ToList();
1832+
// The expected collection can be obtained from the below Linq to Objects query.
1833+
//var expected =
1834+
// (from o in db.Orders.ToList()
1835+
// from p in db.Products.ToList()
1836+
// join d in db.OrderLines.ToList()
1837+
// on new { o.OrderId, p.ProductId } equals new { d.Order.OrderId, d.Product.ProductId }
1838+
// into details
1839+
// from d in details.DefaultIfEmpty()
1840+
// where d != null && d.UnitPrice > 50
1841+
// select new { o.OrderId, p.ProductId, d.UnitPrice }).ToList();
18421842

18431843
using (var substitute = SubstituteDialect())
18441844
using (var sqlSpy = new SqlLogSpy())
18451845
{
18461846
ClearQueryPlanCache();
18471847
substitute.Value.SupportsCrossJoin.Returns(useCrossJoin);
18481848

1849-
actual =
1849+
var actual =
18501850
(from o in db.Orders
18511851
from p in db.Products
18521852
join d in db.OrderLines
@@ -1857,11 +1857,10 @@ from d in details.DefaultIfEmpty()
18571857
select new {o.OrderId, p.ProductId, d.UnitPrice}).ToList();
18581858

18591859
var sql = sqlSpy.GetWholeLog();
1860+
Assert.That(actual.Count, Is.EqualTo(163));
18601861
Assert.That(sql, Does.Contain(useCrossJoin ? "cross join" : "inner join"));
18611862
Assert.That(GetTotalOccurrences(sql, "left outer join"), Is.EqualTo(1));
18621863
}
1863-
1864-
Assert.AreEqual(expected.Count, actual.Count);
18651864
}
18661865

18671866
[Category("JOIN")]

0 commit comments

Comments
 (0)