From 35b51ea371f4220492965073d447667c3926cfc5 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/SimpleQueryTestBase.Select.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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)