From 75389008e177b56f028acf47576a5e7660d06abb Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Tue, 31 Aug 2021 07:42:52 -0700 Subject: [PATCH] Query: Re-enable test for #22896 (#25795) Resolves #22896 --- .../Query/ComplexNavigationsQueryTestBase.cs | 10 ++++++++-- .../Query/ComplexNavigationsQuerySqlServerTest.cs | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs index e01a8b72d77..befe6deb720 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs @@ -4027,7 +4027,7 @@ public virtual Task Collection_FirstOrDefault_entity_reference_accesses_in_proje })); } - [ConditionalTheory(Skip = "issue #22896")] + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Collection_FirstOrDefault_entity_collection_accesses_in_projection(bool async) { @@ -4041,7 +4041,13 @@ public virtual Task Collection_FirstOrDefault_entity_collection_accesses_in_proj Pushdown = l1.OneToMany_Optional1 .Where(x => x.Name == "L2 02") .FirstOrDefault().OneToMany_Optional2.ToList() - })); + }), + elementSorter: e => e.Id, + elementAsserter: (e, a) => + { + Assert.Equal(e.Id, a.Id); + AssertCollection(e.Pushdown, a.Pushdown); + }); } [ConditionalTheory] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index 07e94779576..d0565e6ac2e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -3677,7 +3677,20 @@ public override async Task Collection_FirstOrDefault_entity_collection_accesses_ await base.Collection_FirstOrDefault_entity_collection_accesses_in_projection(async); AssertSql( - @""); + @"SELECT [l].[Id], [t0].[Id], [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [t0].[c] +FROM [LevelOne] AS [l] +LEFT JOIN ( + SELECT [t].[c], [t].[Id], [t].[OneToMany_Optional_Inverse2Id] + FROM ( + SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] + FROM [LevelTwo] AS [l0] + WHERE [l0].[Name] = N'L2 02' + ) AS [t] + WHERE [t].[row] <= 1 +) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] +LEFT JOIN [LevelThree] AS [l1] ON [t0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] +WHERE [l].[Id] < 2 +ORDER BY [l].[Id], [t0].[Id]"); } public override async Task Multiple_collection_FirstOrDefault_followed_by_member_access_in_projection(bool async)