diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs index 6faa1a40e9c..e14fc1cab44 100644 --- a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs +++ b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs @@ -276,8 +276,7 @@ protected override Expression VisitExtension(Expression extensionExpression) case EntityShaperExpression entityShaperExpression: return new EntityReferenceExpression(entityShaperExpression); - case ProjectionBindingExpression projectionBindingExpression - when projectionBindingExpression.ProjectionMember != null: + case ProjectionBindingExpression projectionBindingExpression: return ((InMemoryQueryExpression)projectionBindingExpression.QueryExpression).GetProjection(projectionBindingExpression); default: diff --git a/test/EFCore.InMemory.FunctionalTests/Query/GearsOfWarQueryInMemoryTest.cs b/test/EFCore.InMemory.FunctionalTests/Query/GearsOfWarQueryInMemoryTest.cs index 23eaace61a2..46b1eef9eb5 100644 --- a/test/EFCore.InMemory.FunctionalTests/Query/GearsOfWarQueryInMemoryTest.cs +++ b/test/EFCore.InMemory.FunctionalTests/Query/GearsOfWarQueryInMemoryTest.cs @@ -25,11 +25,15 @@ public override Task Client_member_and_unsupported_string_Equals_in_the_same_que CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear))); } - [ConditionalTheory(Skip = "issue #17540")] - public override Task + public override async Task Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex(bool async) - => base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex( - async); + { + Assert.Equal( + "Nullable object must have a value.", + (await Assert.ThrowsAsync( + () => base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex( + async))).Message); + } [ConditionalTheory(Skip = "issue #19683")] public override Task Group_by_on_StartsWith_with_null_parameter_as_argument(bool async) diff --git a/test/EFCore.InMemory.FunctionalTests/Query/SpatialQueryInMemoryTest.cs b/test/EFCore.InMemory.FunctionalTests/Query/SpatialQueryInMemoryTest.cs index 30890ca9af6..5f741be38c5 100644 --- a/test/EFCore.InMemory.FunctionalTests/Query/SpatialQueryInMemoryTest.cs +++ b/test/EFCore.InMemory.FunctionalTests/Query/SpatialQueryInMemoryTest.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using System.Threading.Tasks; using Xunit; @@ -19,16 +20,14 @@ public override Task Distance_constant_lhs(bool async) return base.Distance_constant_lhs(async); } - [ConditionalTheory(Skip = "issue #19664")] public override Task Intersects_equal_to_null(bool async) { - return base.Intersects_equal_to_null(async); + return Assert.ThrowsAsync(() => base.Intersects_equal_to_null(async)); } - [ConditionalTheory(Skip = "issue #19664")] public override Task Intersects_not_equal_to_null(bool async) { - return base.Intersects_not_equal_to_null(async); + return Assert.ThrowsAsync(() => base.Intersects_not_equal_to_null(async)); } public override Task GetGeometryN_with_null_argument(bool async) diff --git a/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsQueryRelationalFixtureBase.cs b/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsQueryRelationalFixtureBase.cs index 3fb2193ec61..00a646543fe 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsQueryRelationalFixtureBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsQueryRelationalFixtureBase.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.TestUtilities; namespace Microsoft.EntityFrameworkCore.Query @@ -9,5 +10,12 @@ public abstract class ComplexNavigationsQueryRelationalFixtureBase : ComplexNavi { public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + => base.AddOptions(builder).ConfigureWarnings( + c => c + .Log(CoreEventId.DistinctAfterOrderByWithoutRowLimitingOperatorWarning) + .Log(CoreEventId.FirstWithoutOrderByAndFilterWarning)) + .EnableDetailedErrors(); } } diff --git a/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryRelationalFixtureBase.cs b/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryRelationalFixtureBase.cs index 1662deb5f6b..b61011d4d7b 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryRelationalFixtureBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/ComplexNavigationsSharedTypeQueryRelationalFixtureBase.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -18,6 +19,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(eb => eb.ToTable(nameof(Level1))); } + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + => base.AddOptions(builder).ConfigureWarnings( + c => c + .Log(CoreEventId.DistinctAfterOrderByWithoutRowLimitingOperatorWarning) + .Log(CoreEventId.FirstWithoutOrderByAndFilterWarning)) + .EnableDetailedErrors(); protected override void Configure(OwnedNavigationBuilder l2) { diff --git a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs index ead3811794c..77a32131c8d 100644 --- a/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs @@ -2764,7 +2764,7 @@ where l1.Id < 3 select l3).Distinct().OrderBy(l => l.Id).Skip(1).FirstOrDefault().Name); } - [ConditionalTheory(Skip = "issue #8523")] + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(bool async) { @@ -3402,15 +3402,6 @@ public virtual void Join_with_navigations_in_the_result_selector2() var result = query.ToList(); } - [ConditionalFact(Skip = "issue #12200")] - public virtual void GroupJoin_with_navigations_in_the_result_selector() - { - using var ctx = CreateContext(); - var query = ctx.LevelOne.GroupJoin( - ctx.LevelTwo, l1 => l1.Id, l2 => l2.Level1_Required_Id, (o, i) => new { o.OneToOne_Optional_FK1, i }); - var result = query.ToList(); - } - [ConditionalFact] public virtual void Member_pushdown_chain_3_levels_deep() { @@ -3607,7 +3598,7 @@ public virtual Task Sum_with_selector_cast_using_as(bool async) ss => ss.Set().Select(s => s.Id as int?)); } - [ConditionalTheory(Skip = "Issue#12657")] + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Sum_with_filter_with_include_selector_cast_using_as(bool async) { diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index 5efddcda681..7463273c50b 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -7885,7 +7885,7 @@ public virtual Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool } - [ConditionalTheory(Skip = "issue #22692")] + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Cast_to_derived_followed_by_multiple_includes(bool async) { diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index e4297e065c4..ba668023866 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -2526,7 +2526,16 @@ public override async Task Subquery_with_Distinct_Skip_FirstOrDefault_without_Or await base.Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(async); AssertSql( - ""); + @"SELECT ( + SELECT [t].[Name] + FROM ( + SELECT DISTINCT [l0].[Id], [l0].[Level2_Optional_Id], [l0].[Level2_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse3Id], [l0].[OneToMany_Optional_Self_Inverse3Id], [l0].[OneToMany_Required_Inverse3Id], [l0].[OneToMany_Required_Self_Inverse3Id], [l0].[OneToOne_Optional_PK_Inverse3Id], [l0].[OneToOne_Optional_Self3Id] + FROM [LevelThree] AS [l0] + ) AS [t] + ORDER BY (SELECT 1) + OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) +FROM [LevelOne] AS [l] +WHERE [l].[Id] < 3"); } public override async Task Project_collection_navigation_count(bool async) @@ -3106,14 +3115,6 @@ FROM [LevelOne] AS [l] ORDER BY [l].[Id], [l0].[Id], [l1].[Id]"); } - public override void GroupJoin_with_navigations_in_the_result_selector() - { - base.GroupJoin_with_navigations_in_the_result_selector(); - - AssertSql( - @""); - } - public override void Member_pushdown_chain_3_levels_deep() { base.Member_pushdown_chain_3_levels_deep(); @@ -3336,14 +3337,12 @@ public override async Task Sum_with_filter_with_include_selector_cast_using_as(b await base.Sum_with_filter_with_include_selector_cast_using_as(async); AssertSql( - @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] + @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] > ( - SELECT SUM([l1].[Id]) - FROM [LevelTwo] AS [l1] - WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) -ORDER BY [l].[Id], [l0].[Id]"); + SELECT COALESCE(SUM([l0].[Id]), 0) + FROM [LevelTwo] AS [l0] + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])"); } public override async Task Select_with_joined_where_clause_cast_using_as(bool async)