From efa3c6f7da27f7d45873af0b69bc6c26ab5a7363 Mon Sep 17 00:00:00 2001 From: AndriySvyryd Date: Mon, 12 Aug 2019 17:11:24 -0700 Subject: [PATCH] Don't run Select_nested_projection without MARS Fixes #17117 --- .../Query/SimpleQueryCosmosTest.Select.cs | 6 -- .../Query/SimpleQueryTestBase.Select.cs | 26 -------- .../Query/QueryBugsTest.cs | 61 +++++++++++++++++++ .../Query/SimpleQuerySqlServerTest.Select.cs | 6 -- 4 files changed, 61 insertions(+), 38 deletions(-) diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs b/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs index 95c78c858d9..926a4aac751 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.Select.cs @@ -257,12 +257,6 @@ 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 d00d85b6226..aed74cbb086 100644 --- a/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Select.cs +++ b/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Select.cs @@ -408,32 +408,6 @@ 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) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index 9f5cf83bb2b..b359589318d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -6071,6 +6071,67 @@ public class Repo15518 #endregion + #region Bug8864 + + [ConditionalFact] + public virtual void Select_nested_projection() + { + using (CreateDatabase8864()) + { + using (var context = new MyContext8864(_options)) + { + var customers = context.Customers + .Select(c => new + { + Customer = c, + CustomerAgain = Get(context, c.Id) + }) + .ToList(); + + Assert.Equal(2, customers.Count); + + foreach (var customer in customers) + { + Assert.Same(customer.Customer, customer.CustomerAgain); + } + } + } + } + + private static Customer8864 Get(MyContext8864 context, int id) + => context.Customers.Single(c => c.Id == id); + + private SqlServerTestStore CreateDatabase8864() + => CreateTestStore( + () => new MyContext8864(_options), + context => + { + context.AddRange( + new Customer8864 { Name = "Alan" }, + new Customer8864 { Name = "Elon" }); + + context.SaveChanges(); + + ClearLog(); + }); + + public class MyContext8864 : DbContext + { + public DbSet Customers { get; set; } + + public MyContext8864(DbContextOptions options) : base(options) + { + } + } + + public class Customer8864 + { + public int Id { get; set; } + public string Name { get; set; } + } + + #endregion + private DbContextOptions _options; private SqlServerTestStore CreateTestStore( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.Select.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.Select.cs index 92df980aa7e..713d1499933 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.Select.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.Select.cs @@ -1007,11 +1007,5 @@ public override async Task SelectMany_without_result_selector_collection_navigat FROM [Customers] AS [c] INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]"); } - - [ConditionalFact(Skip = "Issue#17117")] - public override void Select_nested_projection() - { - base.Select_nested_projection(); - } } }