-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- moving collection navigation related tests to separate test class - adding split query tests for all these collection-related tests - removing dedicated split query tests, which were just copies of some of the collection tests - for now, split query tests are disabled
- Loading branch information
Showing
25 changed files
with
6,039 additions
and
6,487 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
test/EFCore.InMemory.FunctionalTests/Query/ComplexNavigationsCollectionsQueryInMemoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class ComplexNavigationsCollectionsQueryInMemoryTest : ComplexNavigationsCollectionsQueryTestBase<ComplexNavigationsQueryInMemoryFixture> | ||
{ | ||
public ComplexNavigationsCollectionsQueryInMemoryTest(ComplexNavigationsQueryInMemoryFixture fixture, ITestOutputHelper testOutputHelper) | ||
: base(fixture) | ||
{ | ||
//TestLoggerFactory.TestOutputHelper = testOutputHelper; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...nMemory.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQueryInMemoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class ComplexNavigationsCollectionsSharedTypeQueryInMemoryTest : | ||
ComplexNavigationsCollectionsSharedTypeQueryTestBase<ComplexNavigationsSharedTypeQueryInMemoryFixture> | ||
{ | ||
// ReSharper disable once UnusedParameter.Local | ||
public ComplexNavigationsCollectionsSharedTypeQueryInMemoryTest( | ||
ComplexNavigationsSharedTypeQueryInMemoryFixture fixture, | ||
ITestOutputHelper testOutputHelper) | ||
: base(fixture) | ||
{ | ||
//TestLoggerFactory.TestOutputHelper = testOutputHelper; | ||
} | ||
} | ||
} |
2 changes: 0 additions & 2 deletions
2
test/EFCore.InMemory.FunctionalTests/Query/ComplexNavigationsQueryInMemoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ational.Specification.Tests/Query/ComplexNavigationsCollectionsQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ComplexNavigationsCollectionsQueryRelationalTestBase<TFixture> : ComplexNavigationsCollectionsQueryTestBase<TFixture> | ||
where TFixture : ComplexNavigationsQueryFixtureBase, new() | ||
{ | ||
protected ComplexNavigationsCollectionsQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ecification.Tests/Query/ComplexNavigationsCollectionsSharedQueryTypeRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ComplexNavigationsCollectionsSharedQueryTypeRelationalTestBase<TFixture> : ComplexNavigationsCollectionsSharedTypeQueryTestBase<TFixture> | ||
where TFixture : ComplexNavigationsSharedTypeQueryRelationalFixtureBase, new() | ||
{ | ||
protected ComplexNavigationsCollectionsSharedQueryTypeRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
...al.Specification.Tests/Query/ComplexNavigationsCollectionsSplitQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ComplexNavigationsCollectionsSplitQueryRelationalTestBase<TFixture> : ComplexNavigationsCollectionsQueryTestBase<TFixture> | ||
where TFixture : ComplexNavigationsQueryFixtureBase, new() | ||
{ | ||
protected ComplexNavigationsCollectionsSplitQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected override Expression RewriteServerQueryExpression(Expression serverQueryExpression) | ||
=> new SplitQueryRewritingExpressionVisitor().Visit(serverQueryExpression); | ||
|
||
private class SplitQueryRewritingExpressionVisitor : ExpressionVisitor | ||
{ | ||
private readonly MethodInfo _asSplitQueryMethod | ||
= typeof(RelationalQueryableExtensions).GetMethod(nameof(RelationalQueryableExtensions.AsSplitQuery)); | ||
|
||
protected override Expression VisitExtension(Expression extensionExpression) | ||
{ | ||
if (extensionExpression is QueryRootExpression rootExpression) | ||
{ | ||
var splitMethod = _asSplitQueryMethod.MakeGenericMethod(rootExpression.EntityType.ClrType); | ||
|
||
return Expression.Call(splitMethod, rootExpression); | ||
} | ||
|
||
return base.VisitExtension(extensionExpression); | ||
} | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Complex_query_with_let_collection_projection_FirstOrDefault(bool async) | ||
{ | ||
return base.Complex_query_with_let_collection_projection_FirstOrDefault(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(bool async) | ||
{ | ||
return base.Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Filtered_include_outer_parameter_used_inside_filter(bool async) | ||
{ | ||
return base.Filtered_include_outer_parameter_used_inside_filter(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Include_inside_subquery(bool async) | ||
{ | ||
return base.Include_inside_subquery(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Lift_projection_mapping_when_pushing_down_subquery(bool async) | ||
{ | ||
return base.Lift_projection_mapping_when_pushing_down_subquery(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Null_check_in_anonymous_type_projection_should_not_be_removed(bool async) | ||
{ | ||
return base.Null_check_in_anonymous_type_projection_should_not_be_removed(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Null_check_in_Dto_projection_should_not_be_removed(bool async) | ||
{ | ||
return base.Null_check_in_Dto_projection_should_not_be_removed(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Project_collection_navigation_composed(bool async) | ||
{ | ||
return base.Project_collection_navigation_composed(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Project_collection_navigation_nested_with_take(bool async) | ||
{ | ||
return base.Project_collection_navigation_nested_with_take(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Select_nav_prop_collection_one_to_many_required(bool async) | ||
{ | ||
return base.Select_nav_prop_collection_one_to_many_required(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Select_subquery_single_nested_subquery(bool async) | ||
{ | ||
return base.Select_subquery_single_nested_subquery(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Select_subquery_single_nested_subquery2(bool async) | ||
{ | ||
return base.Select_subquery_single_nested_subquery2(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task SelectMany_DefaultIfEmpty_multiple_times_with_joins_projecting_a_collection(bool async) | ||
{ | ||
return base.SelectMany_DefaultIfEmpty_multiple_times_with_joins_projecting_a_collection(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Skip_Take_Select_collection_Skip_Take(bool async) | ||
{ | ||
return base.Skip_Take_Select_collection_Skip_Take(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Take_Select_collection_Take(bool async) | ||
{ | ||
return base.Take_Select_collection_Take(async); | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
...cation.Tests/Query/ComplexNavigationsCollectionsSplitSharedQueryTypeRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ComplexNavigationsCollectionsSplitSharedQueryTypeRelationalTestBase<TFixture> : ComplexNavigationsCollectionsSharedTypeQueryTestBase<TFixture> | ||
where TFixture : ComplexNavigationsSharedTypeQueryRelationalFixtureBase, new() | ||
{ | ||
protected ComplexNavigationsCollectionsSplitSharedQueryTypeRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected override Expression RewriteServerQueryExpression(Expression serverQueryExpression) | ||
=> new SplitQueryRewritingExpressionVisitor().Visit(serverQueryExpression); | ||
|
||
private class SplitQueryRewritingExpressionVisitor : ExpressionVisitor | ||
{ | ||
private readonly MethodInfo _asSplitQueryMethod | ||
= typeof(RelationalQueryableExtensions).GetMethod(nameof(RelationalQueryableExtensions.AsSplitQuery)); | ||
|
||
protected override Expression VisitExtension(Expression extensionExpression) | ||
{ | ||
if (extensionExpression is QueryRootExpression rootExpression) | ||
{ | ||
var splitMethod = _asSplitQueryMethod.MakeGenericMethod(rootExpression.EntityType.ClrType); | ||
|
||
return Expression.Call(splitMethod, rootExpression); | ||
} | ||
|
||
return base.VisitExtension(extensionExpression); | ||
} | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Complex_query_with_let_collection_projection_FirstOrDefault(bool async) | ||
{ | ||
return base.Complex_query_with_let_collection_projection_FirstOrDefault(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(bool async) | ||
{ | ||
return base.Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Filtered_include_outer_parameter_used_inside_filter(bool async) | ||
{ | ||
return base.Filtered_include_outer_parameter_used_inside_filter(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Include_inside_subquery(bool async) | ||
{ | ||
return base.Include_inside_subquery(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Lift_projection_mapping_when_pushing_down_subquery(bool async) | ||
{ | ||
return base.Lift_projection_mapping_when_pushing_down_subquery(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Null_check_in_anonymous_type_projection_should_not_be_removed(bool async) | ||
{ | ||
return base.Null_check_in_anonymous_type_projection_should_not_be_removed(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Null_check_in_Dto_projection_should_not_be_removed(bool async) | ||
{ | ||
return base.Null_check_in_Dto_projection_should_not_be_removed(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Project_collection_navigation_composed(bool async) | ||
{ | ||
return base.Project_collection_navigation_composed(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Project_collection_navigation_nested_with_take(bool async) | ||
{ | ||
return base.Project_collection_navigation_nested_with_take(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Select_nav_prop_collection_one_to_many_required(bool async) | ||
{ | ||
return base.Select_nav_prop_collection_one_to_many_required(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Select_subquery_single_nested_subquery(bool async) | ||
{ | ||
return base.Select_subquery_single_nested_subquery(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Select_subquery_single_nested_subquery2(bool async) | ||
{ | ||
return base.Select_subquery_single_nested_subquery2(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task SelectMany_DefaultIfEmpty_multiple_times_with_joins_projecting_a_collection(bool async) | ||
{ | ||
return base.SelectMany_DefaultIfEmpty_multiple_times_with_joins_projecting_a_collection(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Skip_Take_Select_collection_Skip_Take(bool async) | ||
{ | ||
return base.Skip_Take_Select_collection_Skip_Take(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query not fully supported yet.")] | ||
public override Task Take_Select_collection_Take(bool async) | ||
{ | ||
return base.Take_Select_collection_Take(async); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Split query bug")] | ||
public override Task Include_reference_collection_order_by_reference_navigation(bool async) | ||
{ | ||
return base.Include_reference_collection_order_by_reference_navigation(async); | ||
} | ||
} | ||
} |
Oops, something went wrong.