Skip to content

Commit 488f4d6

Browse files
authored
Query: Add regression test for #21003 (#23480)
Resolves #21003
1 parent 3bd012b commit 488f4d6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,33 @@ public virtual Task GroupBy_scalar_aggregate_in_set_operation(bool async)
30093009
elementSorter: e => (e.CustomerID, e.Sequence));
30103010
}
30113011

3012+
[ConditionalTheory]
3013+
[MemberData(nameof(IsAsyncData))]
3014+
public virtual Task AsEnumerable_in_subquery_for_GroupBy(bool async)
3015+
{
3016+
return AssertTranslationFailed(
3017+
() => AssertQuery(
3018+
async,
3019+
ss => ss.Set<Customer>()
3020+
.Where(c => c.CustomerID.StartsWith("F"))
3021+
.Select(c => new
3022+
{
3023+
Customer = c,
3024+
Orders = ss.Set<Order>()
3025+
.Where(o => o.CustomerID == c.CustomerID)
3026+
.AsEnumerable()
3027+
.GroupBy(o => o.CustomerID)
3028+
.Select(g => g.OrderByDescending(e => e.OrderDate).FirstOrDefault())
3029+
.ToList()
3030+
}),
3031+
elementSorter: e => e.Customer.CustomerID,
3032+
elementAsserter: (e, a) =>
3033+
{
3034+
AssertEqual(e.Customer, a.Customer);
3035+
AssertCollection(e.Orders, a.Orders);
3036+
}));
3037+
}
3038+
30123039
#endregion
30133040
}
30143041
}

0 commit comments

Comments
 (0)