Skip to content

Commit

Permalink
Adding regression tests for some issues fixed earlier
Browse files Browse the repository at this point in the history
Resolves #13560
Resolves #17364
Resolves #17803
Resolves #21078
Resolves #21828
Resolves #23041
  • Loading branch information
maumar committed Sep 2, 2021
1 parent 05725c9 commit aee788e
Show file tree
Hide file tree
Showing 17 changed files with 383 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ public override async Task Can_use_backwards_of_type_animal(bool async)
{
await base.Can_use_backwards_of_type_animal(async);

AssertSql(" ");
AssertSql(
@"SELECT c
FROM root c
WHERE (c[""Discriminator""] = ""Kiwi"")");
}

public override async Task Can_use_of_type_rose(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ where ov.Customer.Orders.Any()
AssertSql(@"");
}

[ConditionalTheory(Skip = "issue#17314")] // left join translation
public override async Task KeylessEntity_with_included_navs_multi_level(bool async)
{
await base.KeylessEntity_with_included_navs_multi_level(async);

AssertSql(@"");
}

[ConditionalTheory(Skip = "Issue #17246")]
public override async Task KeylessEntity_groupby(bool async)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ public override void Entity_mapped_to_view_on_right_side_of_join()

public override async Task KeylessEntity_with_included_nav(bool async)
{
await Assert.ThrowsAsync<InvalidOperationException>(() => base.KeylessEntity_with_included_nav(async));
await Assert.ThrowsAsync<InvalidOperationException>(
() => base.KeylessEntity_with_included_nav(async));
}

public override async Task KeylessEntity_with_included_navs_multi_level(bool async)
{
await Assert.ThrowsAsync<InvalidOperationException>(
() => base.KeylessEntity_with_included_navs_multi_level(async));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ public virtual async Task Collection_of_entities_projecting_correlated_collectio
Assert.Equal(RelationalStrings.InsufficientInformationToIdentifyOuterElementOfCollectionJoin, message);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public override async Task KeylessEntity_with_included_navs_multi_level(bool async)
{
var message = (await Assert.ThrowsAsync<InvalidOperationException>(
() => base.KeylessEntity_with_included_navs_multi_level(async))).Message;

Assert.Equal(RelationalStrings.InsufficientInformationToIdentifyOuterElementOfCollectionJoin, message);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public override async Task KeylessEntity_with_defining_query_and_correlated_collection(bool async)
{
var message = (await Assert.ThrowsAsync<InvalidOperationException>(
() => base.KeylessEntity_with_defining_query_and_correlated_collection(async))).Message;

Assert.Equal(RelationalStrings.InsufficientInformationToIdentifyOuterElementOfCollectionJoin, message);
}

protected override QueryAsserter CreateQueryAsserter(TFixture fixture)
=> new RelationalQueryAsserter(
fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,47 @@ public virtual Task Filtered_include_Skip_Take_with_another_Skip_Take_on_top_lev
new ExpectedInclude<Level2>(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1")));
}


[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filtered_include_with_Take_without_order_by_followed_by_ThenInclude_and_FirstOrDefault_on_top_level(bool async)
{
return AssertFirstOrDefault(
async,
ss => ss.Set<Level1>()
.OrderBy(l1 => l1.Id)
.Include(l1 => l1.OneToMany_Optional1.Take(40))
.ThenInclude(l2 => l2.OneToOne_Optional_FK2),
asserter: (e, a) => AssertInclude(
e,
a,
new ExpectedFilteredInclude<Level1, Level2>(
x => x.OneToMany_Optional1,
includeFilter: x => x.Take(40)),
new ExpectedInclude<Level2>(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1")));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Filtered_include_with_Take_without_order_by_followed_by_ThenInclude_and_unordered_Take_on_top_level(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Level1>()
.OrderBy(l1 => l1.Id)
.Include(l1 => l1.OneToMany_Optional1.Take(40))
.ThenInclude(l2 => l2.OneToOne_Optional_FK2)
.Take(30),
elementSorter: e => e.Id,
elementAsserter: (e, a) => AssertInclude(
e,
a,
new ExpectedFilteredInclude<Level1, Level2>(
x => x.OneToMany_Optional1,
includeFilter: x => x.Take(40)),
new ExpectedInclude<Level2>(x => x.OneToOne_Optional_FK2, "OneToMany_Optional1")));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Projecting_collection_with_FirstOrDefault(bool async)
Expand Down Expand Up @@ -2443,5 +2484,39 @@ public virtual Task Include_partially_added_before_Where_and_then_build_upon_wit
.ThenInclude(l3 => l3.OneToOne_Optional_FK3),
elementAsserter: (e, a) => AssertInclude(e, a, expectedIncludes));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Take_on_correlated_collection_in_projection(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Level1>().Select(l1 => new { l1.Id, Collection = l1.OneToMany_Optional1.Take(50) }),
elementSorter: e => e.Id,
elementAsserter: (e, a) =>
{
AssertEqual(e.Id, a.Id);
AssertCollection(e.Collection, a.Collection);
});
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task FirstOrDefault_with_predicate_on_correlated_collection_in_projection(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Level1>().Select(l1 => new
{
l1.Id,
Element = l1.OneToMany_Optional1.FirstOrDefault(l2 => l2.Id == l1.Id)
}),
elementSorter: e => e.Id,
elementAsserter: (e, a) =>
{
AssertEqual(e.Id, a.Id);
AssertEqual(e.Element, a.Element);
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ protected ComplexNavigationsCollectionsSharedTypeQueryTestBase(TFixture fixture)
{
}

// Self-ref not supported
public override Task Multiple_complex_includes_self_ref(bool async)
=> Task.CompletedTask;

[ConditionalTheory(Skip = "issue #13560")]
[ConditionalTheory]
public override Task Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(bool async)
=> base.Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_with_other_query_operators_composed_on_top(async);
=> Task.CompletedTask;

// include after select is not supported
public override Task Include_collection_with_multiple_orderbys_complex(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,25 @@ protected ComplexNavigationsSharedTypeQueryTestBase(TFixture fixture)

// Self-ref not supported
public override Task Join_navigation_self_ref(bool async)
{
return Task.CompletedTask;
}
=> Task.CompletedTask;

public override Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(bool async)
{
return Task.CompletedTask;
}
=> Task.CompletedTask;

public override Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_single_property(bool async)
{
return Task.CompletedTask;
}
=> Task.CompletedTask;

[ConditionalTheory(Skip = "issue #13560")]
public override Task Multiple_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_joined_together(bool async)
{
return base.Multiple_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpty_joined_together(async);
}
=> Task.CompletedTask;

[ConditionalTheory(Skip = "issue #13560")]
public override Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany(
bool async)
{
return base.SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany(async);
}
public override Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany(bool async)
=> Task.CompletedTask;

[ConditionalTheory(Skip = "issue #13560")]
public override Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2(
bool async)
{
return base.SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2(async);
}
public override Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany2(bool async)
=> Task.CompletedTask;

[ConditionalTheory(Skip = "issue #13560")]
public override Task SelectMany_with_nested_navigations_and_additional_joins_outside_of_SelectMany(bool async)
{
return base.SelectMany_with_nested_navigations_and_additional_joins_outside_of_SelectMany(async);
}
=> Task.CompletedTask;

[ConditionalTheory(Skip = "Issue#16752")]
public override Task Include8(bool async)
Expand All @@ -68,12 +48,6 @@ public override Task Include9(bool async)
return base.Include9(async);
}

[ConditionalTheory(Skip = "Issue#17803")]
public override Task Member_pushdown_with_multiple_collections(bool async)
{
return base.Member_pushdown_with_multiple_collections(async);
}

// Cannot create DbSet for Level2
public override void Join_with_navigations_in_the_result_selector2()
{
Expand All @@ -94,12 +68,6 @@ public override void Member_pushdown_with_collection_navigation_in_the_middle()
public override Task Union_over_entities_with_different_nullability(bool async)
=> Task.CompletedTask;

[ConditionalTheory(Skip = "Issue#17803")]
public override Task Multiple_collection_FirstOrDefault_followed_by_member_access_in_projection(bool async)
{
return base.Multiple_collection_FirstOrDefault_followed_by_member_access_in_projection(async);
}

public override Task Project_shadow_properties(bool async)
=> Task.CompletedTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public virtual Task Can_use_of_type_kiwi(bool async)
entryCount: 1);
}

[ConditionalTheory(Skip = "Issue#17364")]
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Can_use_backwards_of_type_animal(bool async)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public virtual Task KeylessEntity_with_defining_query(bool async)
ss => ss.Set<OrderQuery>().Where(ov => ov.CustomerID == "ALFKI"));
}

[ConditionalTheory(Skip = "Issue#21828")]
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task KeylessEntity_with_defining_query_and_correlated_collection(bool async)
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public virtual Task KeylessEntity_with_included_nav(bool async)
entryCount: 1);
}

[ConditionalTheory(Skip = "Issue#21828")]
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task KeylessEntity_with_included_navs_multi_level(bool async)
{
Expand Down
Loading

0 comments on commit aee788e

Please sign in to comment.