Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test for #23303 #28059

Merged
1 commit merged into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public ComplexNavigationsCollectionsQueryInMemoryTest(
{
//TestLoggerFactory.TestOutputHelper = testOutputHelper;
}

public override async Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
// Nested collection with ToList. Issue #23303.
=> await Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public ComplexNavigationsCollectionsSharedTypeQueryInMemoryTest(
{
//TestLoggerFactory.TestOutputHelper = testOutputHelper;
}

public override Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
// Nested collection with ToList. Issue #23303.
=> Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
}
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ public virtual Task Complex_query_with_let_collection_projection_FirstOrDefault_
async,
ss => from l1 in ss.Set<Level1>()
orderby l1.Id
let inner = (from l2 in l1.OneToMany_Optional1
let inner = (from l2 in ss.Set<Level2>()
where l2.Name != "Foo"
let innerL1s = from innerL1 in ss.Set<Level1>()
let innerL1s = (from innerL1 in ss.Set<Level1>()
where innerL1.OneToMany_Optional1.Any(innerL2 => innerL2.Id == l2.Id)
select innerL1.Name
select innerL1.Name).AsEnumerable()
select innerL1s.ToList()).FirstOrDefault()
select inner.ToList(),
assertOrder: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2367,31 +2367,25 @@ FROM [LevelOne] AS [l]

public override async Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
{
// Nested collection with ToList. Issue #23303.
await Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
await base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async);

AssertSql(
@"SELECT [l].[Id], [t0].[Id], [t1].[Name], [t1].[Id], [t0].[c]
@"SELECT [l].[Id], [t].[Id], [t0].[Name], [t0].[Id], [t].[c]
FROM [LevelOne] AS [l]
LEFT JOIN (
SELECT [t].[c], [t].[Id], [t].[OneToMany_Optional_Inverse2Id]
FROM (
SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row]
FROM [LevelTwo] AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
WHERE [t].[row] <= 1
) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]
OUTER APPLY (
SELECT TOP(1) 1 AS [c], [l0].[Id]
FROM [LevelTwo] AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
OUTER APPLY (
SELECT [l1].[Name], [l1].[Id]
FROM [LevelOne] AS [l1]
WHERE EXISTS (
SELECT 1
FROM [LevelTwo] AS [l2]
WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t0].[Id])
) AS [t1]
ORDER BY [l].[Id], [t0].[Id]");
WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t].[Id])
) AS [t0]
ORDER BY [l].[Id], [t].[Id]");
}

public override async Task Include_collection_with_multiple_orderbys_complex_repeated_checked(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,34 @@ public virtual void Check_all_tests_overridden()

public override async Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
{
// Nested collection with ToList. Issue #23303.
await Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
await base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async);

AssertSql(
@"SELECT [l].[Id], [t0].[Id], [t1].[Name], [t1].[Id], [t0].[c]
@"SELECT [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Name], [t1].[Id], [t0].[c]
FROM [Level1] AS [l]
LEFT JOIN (
SELECT [t].[c], [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToMany_Optional_Inverse2Id]
FROM (
SELECT 1 AS [c], [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row]
FROM [Level1] AS [l0]
WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL)
) AS [t]
WHERE [t].[row] <= 1
) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]
OUTER APPLY (
SELECT [l1].[Name], [l1].[Id]
FROM [Level1] AS [l1]
SELECT TOP(1) 1 AS [c], [l0].[Id], [t].[Id] AS [Id0], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id]
FROM [Level1] AS [l0]
LEFT JOIN (
SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id]
FROM [Level1] AS [l1]
WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL
) AS [t] ON [l0].[Id] = CASE
WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id]
END
WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([t].[Level2_Name] <> N'Foo' OR [t].[Level2_Name] IS NULL)
) AS [t0]
OUTER APPLY (
SELECT [l2].[Name], [l2].[Id]
FROM [Level1] AS [l2]
WHERE EXISTS (
SELECT 1
FROM [Level1] AS [l2]
WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = CASE
WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id]
FROM [Level1] AS [l3]
WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = CASE
WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0]
END)
) AS [t1]
ORDER BY [l].[Id], [t0].[Id]");
ORDER BY [l].[Id], [t0].[Id], [t0].[Id0]");
}

public override async Task SelectMany_with_Include1(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,44 +1245,34 @@ public override async Task Queryable_in_subquery_works_when_final_projection_is_

public override async Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
{
// Nested collection with ToList. Issue #23303.
await Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
await base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async);

AssertSql(
@"SELECT [l].[Id], [t0].[Id], [t0].[c]
@"SELECT [l].[Id], [t].[Id], [t].[c]
FROM [LevelOne] AS [l]
LEFT JOIN (
SELECT [t].[c], [t].[Id], [t].[OneToMany_Optional_Inverse2Id]
FROM (
SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row]
FROM [LevelTwo] AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
WHERE [t].[row] <= 1
) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]
ORDER BY [l].[Id], [t0].[Id]",
//
@"SELECT [t1].[Name], [l].[Id], [t0].[Id]
OUTER APPLY (
SELECT TOP(1) 1 AS [c], [l0].[Id]
FROM [LevelTwo] AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
ORDER BY [l].[Id], [t].[Id]",
//
@"SELECT [t0].[Name], [l].[Id], [t].[Id]
FROM [LevelOne] AS [l]
LEFT JOIN (
SELECT [t].[Id], [t].[OneToMany_Optional_Inverse2Id]
FROM (
SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row]
FROM [LevelTwo] AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
WHERE [t].[row] <= 1
) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]
OUTER APPLY (
SELECT TOP(1) [l0].[Id]
FROM [LevelTwo] AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
CROSS APPLY (
SELECT [l1].[Name]
FROM [LevelOne] AS [l1]
WHERE EXISTS (
SELECT 1
FROM [LevelTwo] AS [l2]
WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t0].[Id])
) AS [t1]
ORDER BY [l].[Id], [t0].[Id]");
WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t].[Id])
) AS [t0]
ORDER BY [l].[Id], [t].[Id]");
}

public override async Task Complex_query_with_let_collection_projection_FirstOrDefault(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ public ComplexNavigationsCollectionsSplitSharedTypeQuerySqlServerTest(
Fixture.TestSqlLoggerFactory.Clear();
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
}

public override Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
// Nested collection with ToList. Issue #23303.
=> Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
}
Original file line number Diff line number Diff line change
Expand Up @@ -1091,32 +1091,25 @@ ELSE CAST(0 AS bit)

public override async Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
{
// Nested collection with ToList. Issue #23303.

await Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
await base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async);

AssertSql(
@"SELECT [l].[Id], [t0].[Id], [t1].[Name], [t1].[Id], [t0].[c]
@"SELECT [l].[Id], [t].[Id], [t0].[Name], [t0].[Id], [t].[c]
FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l]
LEFT JOIN (
SELECT [t].[c], [t].[Id], [t].[OneToMany_Optional_Inverse2Id]
FROM (
SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row]
FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
WHERE [t].[row] <= 1
) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]
OUTER APPLY (
SELECT TOP(1) 1 AS [c], [l0].[Id]
FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0]
WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL
) AS [t]
OUTER APPLY (
SELECT [l1].[Name], [l1].[Id]
FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1]
WHERE EXISTS (
SELECT 1
FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2]
WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t0].[Id])
) AS [t1]
ORDER BY [l].[Id], [t0].[Id]");
WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t].[Id])
) AS [t0]
ORDER BY [l].[Id], [t].[Id]");
}

public override async Task Skip_on_grouping_element(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id]
ORDER BY [l].[Id], [t0].[Id]");
}

[ConditionalTheory(Skip = "See issue#28058")]
public override async Task Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(bool async)
{
// Nested collection with ToList. Issue #23303.
await Assert.ThrowsAsync<ArgumentNullException>(
() => base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async));
await base.Complex_query_with_let_collection_projection_FirstOrDefault_with_ToList_on_inner_and_outer(async);

AssertSql(
@"SELECT [l].[Id], [t0].[Id], [t1].[Name], [t1].[Id], [t0].[c]
Expand Down