Skip to content

Commit ff8767b

Browse files
committed
Added unit test
1 parent cd7fe59 commit ff8767b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/NHibernate.Test/Linq/LinqQuerySamples.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,22 @@ into g
897897
ObjectDumper.Write(q, 1);
898898
}
899899

900+
[Test]
901+
public void GroupTwoQueriesAndSum()
902+
{
903+
//NH-3534
904+
var queryWithAggregation = from o1 in db.Orders
905+
from o2 in db.Orders
906+
where o1.Customer.CustomerId == o2.Customer.CustomerId && o1.OrderDate == o2.OrderDate
907+
group o1 by new { o1.Customer.CustomerId, o1.OrderDate } into g
908+
select new { CustomerId = g.Key.CustomerId, LastOrderDate = g.Max(x => x.OrderDate) };
909+
910+
var result = queryWithAggregation.ToList();
911+
912+
Assert.IsNotNull(result);
913+
Assert.IsNotEmpty(result);
914+
}
915+
900916
[Category("GROUP BY/HAVING")]
901917
[Test(Description = "This sample uses a where clause after a group by clause " +
902918
"to find all categories that have at least 10 products.")]

0 commit comments

Comments
 (0)