Add primitive collection regression test (#32330)
This commit is contained in:
Родитель
54e0df0106
Коммит
f55b4a0c83
|
@ -748,6 +748,14 @@ public abstract class PrimitiveCollectionsQueryTestBase<TFixture> : QueryTestBas
|
|||
assertOrder: true,
|
||||
elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee));
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(IsAsyncData))]
|
||||
public virtual Task Project_collection_of_ints_with_ToList_and_FirstOrDefault(bool async)
|
||||
=> AssertFirstOrDefault(
|
||||
async,
|
||||
ss => ss.Set<PrimitiveCollectionsEntity>().OrderBy(x => x.Id).Select(x => x.Ints.ToList()),
|
||||
asserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee));
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(IsAsyncData))]
|
||||
public virtual Task Project_empty_collection_of_nullables_and_collection_only_containing_nulls(bool async)
|
||||
|
|
|
@ -589,6 +589,18 @@ ORDER BY [p].[Id]
|
|||
AssertSql("");
|
||||
}
|
||||
|
||||
public override async Task Project_collection_of_ints_with_ToList_and_FirstOrDefault(bool async)
|
||||
{
|
||||
await base.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async);
|
||||
|
||||
AssertSql(
|
||||
"""
|
||||
SELECT TOP(1) [p].[Ints]
|
||||
FROM [PrimitiveCollectionsEntity] AS [p]
|
||||
ORDER BY [p].[Id]
|
||||
""");
|
||||
}
|
||||
|
||||
public override Task Project_multiple_collections(bool async)
|
||||
// we don't propagate error details from projection
|
||||
=> AssertTranslationFailed(() => base.Project_multiple_collections(async));
|
||||
|
|
|
@ -1168,6 +1168,23 @@ ORDER BY [p].[Id]
|
|||
AssertSql("");
|
||||
}
|
||||
|
||||
public override async Task Project_collection_of_ints_with_ToList_and_FirstOrDefault(bool async)
|
||||
{
|
||||
await base.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async);
|
||||
|
||||
AssertSql(
|
||||
"""
|
||||
SELECT [t].[Id], CAST([i].[value] AS int) AS [value], [i].[key]
|
||||
FROM (
|
||||
SELECT TOP(1) [p].[Id], [p].[Ints]
|
||||
FROM [PrimitiveCollectionsEntity] AS [p]
|
||||
ORDER BY [p].[Id]
|
||||
) AS [t]
|
||||
OUTER APPLY OPENJSON([t].[Ints]) AS [i]
|
||||
ORDER BY [t].[Id], CAST([i].[key] AS int)
|
||||
""");
|
||||
}
|
||||
|
||||
public override async Task Project_empty_collection_of_nullables_and_collection_only_containing_nulls(bool async)
|
||||
{
|
||||
await base.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async);
|
||||
|
|
|
@ -1084,6 +1084,12 @@ ORDER BY "p"."Id"
|
|||
(await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => base.Project_collection_of_nullable_ints_with_distinct(async))).Message);
|
||||
|
||||
public override async Task Project_collection_of_ints_with_ToList_and_FirstOrDefault(bool async)
|
||||
=> Assert.Equal(
|
||||
SqliteStrings.ApplyNotSupported,
|
||||
(await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => base.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async))).Message);
|
||||
|
||||
public override async Task Project_multiple_collections(bool async)
|
||||
=> Assert.Equal(
|
||||
SqliteStrings.ApplyNotSupported,
|
||||
|
|
Загрузка…
Ссылка в новой задаче