From a1abf86692260c9b8e1cb02700d03e2f71d3ecdf Mon Sep 17 00:00:00 2001 From: AndriySvyryd Date: Mon, 12 Aug 2019 13:32:44 -0700 Subject: [PATCH] Test for #8864 Resolves #8864 --- .../Query/SimpleQueryCosmosTest.Select.cs | 6 +++++ .../Query/SimpleQueryTestBase.Select.cs | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs b/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs index 926a4aac751..95c78c858d9 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs @@ -257,6 +257,12 @@ FROM root c WHERE ((c[""Discriminator""] = ""Customer"") AND (c[""City""] = ""London""))"); } + [ConditionalTheory(Skip = "Issue #16143")] + public override void Select_nested_projection() + { + base.Select_nested_projection(); + } + public override async Task Select_nested_collection(bool isAsync) { await base.Select_nested_collection(isAsync); diff --git a/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Select.cs b/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Select.cs index d9cc42d083b..1036067e8c0 100644 --- a/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Select.cs +++ b/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Select.cs @@ -408,6 +408,32 @@ from c in cs select c.City); } + [ConditionalFact] + public virtual void Select_nested_projection() + { + using (var context = CreateContext()) + { + var customers = context.Customers + .Where(c => c.CustomerID.StartsWith("A")) + .Select(c => new + { + Customer = c, + CustomerAgain = Get(context, c.CustomerID) + }) + .ToList(); + + Assert.Equal(4, customers.Count); + + foreach (var customer in customers) + { + Assert.Same(customer.Customer, customer.CustomerAgain); + } + } + } + + private static Customer Get(NorthwindContext context, string id) + => context.Customers.Single(c => c.CustomerID == id); + [ConditionalTheory(Skip = "Issue#16314")] [MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_collection(bool isAsync)