You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
704 lines
26 KiB
C#
704 lines
26 KiB
C#
// 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 EntityFrameworkCore.Jet.FunctionalTests.TestUtilities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
|
using Microsoft.EntityFrameworkCore.Query;
|
|
using Microsoft.EntityFrameworkCore.TestUtilities;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace EntityFrameworkCore.Jet.FunctionalTests.Query;
|
|
|
|
/// <summary>
|
|
/// Runs all primitive collection tests with SQL Server compatibility level 120 (SQL Server 2014), which doesn't support OPENJSON.
|
|
/// This exercises the older translation paths for e.g. Contains, to make sure things work for providers with no queryable constant/
|
|
/// parameter support.
|
|
/// </summary>
|
|
public class PrimitiveCollectionsQueryJetTest : PrimitiveCollectionsQueryRelationalTestBase<
|
|
PrimitiveCollectionsQueryJetTest.PrimitiveCollectionsQueryJetFixture>
|
|
{
|
|
public PrimitiveCollectionsQueryJetTest(PrimitiveCollectionsQueryJetFixture fixture, ITestOutputHelper testOutputHelper)
|
|
: base(fixture)
|
|
{
|
|
Fixture.TestSqlLoggerFactory.Clear();
|
|
Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
|
|
}
|
|
|
|
public override async Task Inline_collection_of_ints_Contains(bool async)
|
|
{
|
|
await base.Inline_collection_of_ints_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Int` IN (10, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_of_nullable_ints_Contains(bool async)
|
|
{
|
|
await base.Inline_collection_of_nullable_ints_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`NullableInt` IN (10, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_of_nullable_ints_Contains_null(bool async)
|
|
{
|
|
await base.Inline_collection_of_nullable_ints_Contains_null(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999
|
|
""");
|
|
}
|
|
|
|
public override Task Inline_collection_Count_with_zero_values(bool async)
|
|
=> AssertTranslationFailedWithDetails(
|
|
() => base.Inline_collection_Count_with_zero_values(async),
|
|
RelationalStrings.EmptyCollectionNotSupportedAsInlineQueryRoot);
|
|
|
|
public override async Task Inline_collection_Count_with_one_value(bool async)
|
|
{
|
|
await base.Inline_collection_Count_with_one_value(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
|
|
FROM [PrimitiveCollectionsEntity] AS [p]
|
|
WHERE (
|
|
SELECT COUNT(*)
|
|
FROM (VALUES (CAST(2 AS int))) AS [v]([Value])
|
|
WHERE [v].[Value] > [p].[Id]) = 1
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Count_with_two_values(bool async)
|
|
{
|
|
await base.Inline_collection_Count_with_two_values(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
|
|
FROM [PrimitiveCollectionsEntity] AS [p]
|
|
WHERE (
|
|
SELECT COUNT(*)
|
|
FROM (VALUES (CAST(2 AS int)), (999)) AS [v]([Value])
|
|
WHERE [v].[Value] > [p].[Id]) = 1
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Count_with_three_values(bool async)
|
|
{
|
|
await base.Inline_collection_Count_with_three_values(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
|
|
FROM [PrimitiveCollectionsEntity] AS [p]
|
|
WHERE (
|
|
SELECT COUNT(*)
|
|
FROM (VALUES (CAST(2 AS int)), (999), (1000)) AS [v]([Value])
|
|
WHERE [v].[Value] > [p].[Id]) = 2
|
|
""");
|
|
}
|
|
|
|
public override Task Inline_collection_Contains_with_zero_values(bool async)
|
|
=> AssertTranslationFailedWithDetails(
|
|
() => base.Inline_collection_Contains_with_zero_values(async),
|
|
RelationalStrings.EmptyCollectionNotSupportedAsInlineQueryRoot);
|
|
|
|
public override async Task Inline_collection_Contains_with_one_value(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_with_one_value(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` = 2
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Contains_with_two_values(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_with_two_values(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` IN (2, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Contains_with_three_values(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_with_three_values(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` IN (2, 999, 1000)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Contains_with_all_parameters(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_with_all_parameters(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
@__i_0='2'
|
|
@__j_1='999'
|
|
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` IN (@__i_0, @__j_1)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Contains_with_constant_and_parameter(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_with_constant_and_parameter(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
@__j_0='999'
|
|
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` IN (2, @__j_0)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Contains_with_mixed_value_types(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_with_mixed_value_types(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
@__i_0='11'
|
|
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Int` IN (999, @__i_0, `p`.`Id`, `p`.`Id` + `p`.`Int`)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_Contains_as_Any_with_predicate(bool async)
|
|
{
|
|
await base.Inline_collection_Contains_as_Any_with_predicate(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` IN (2, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Inline_collection_negated_Contains_as_All(bool async)
|
|
{
|
|
await base.Inline_collection_negated_Contains_as_All(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` NOT IN (2, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_Count(bool async)
|
|
{
|
|
await base.Parameter_collection_Count(async);
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_ints_Contains(bool async)
|
|
{
|
|
await base.Parameter_collection_of_ints_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Int` IN (10, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_nullable_ints_Contains_int(bool async)
|
|
{
|
|
await base.Parameter_collection_of_nullable_ints_Contains_int(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Int` IN (10, 999)
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int(bool async)
|
|
{
|
|
await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_strings_Contains_non_nullable_string(bool async)
|
|
{
|
|
await base.Parameter_collection_of_strings_Contains_non_nullable_string(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`String` IN ('10', '999')
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_strings_Contains_nullable_string(bool async)
|
|
{
|
|
await base.Parameter_collection_of_strings_Contains_nullable_string(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`NullableString` IS NULL OR `p`.`NullableString` = '999'
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_DateTimes_Contains(bool async)
|
|
{
|
|
await base.Parameter_collection_of_DateTimes_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`DateTime` IN (#2020-01-10 12:30:00#, #9999-01-01#)
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_bools_Contains(bool async)
|
|
{
|
|
await base.Parameter_collection_of_bools_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Bool` = TRUE
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_of_enums_Contains(bool async)
|
|
{
|
|
await base.Parameter_collection_of_enums_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Enum` IN (0, 3)
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_null_Contains(bool async)
|
|
{
|
|
await base.Parameter_collection_null_Contains(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE 0 = 1
|
|
""");
|
|
}
|
|
|
|
public override async Task Column_collection_of_ints_Contains(bool async)
|
|
{
|
|
await base.Column_collection_of_ints_Contains(async);
|
|
}
|
|
|
|
public override async Task Column_collection_of_nullable_ints_Contains(bool async)
|
|
{
|
|
await base.Column_collection_of_nullable_ints_Contains(async);
|
|
}
|
|
|
|
public override async Task Column_collection_of_nullable_ints_Contains_null(bool async)
|
|
{
|
|
await base.Column_collection_of_nullable_ints_Contains_null(async);
|
|
}
|
|
|
|
public override async Task Column_collection_of_strings_contains_null(bool async)
|
|
{
|
|
await base.Column_collection_of_strings_contains_null(async);
|
|
}
|
|
|
|
public override async Task Column_collection_of_nullable_strings_contains_null(bool async)
|
|
{
|
|
await base.Column_collection_of_nullable_strings_contains_null(async);
|
|
}
|
|
|
|
public override async Task Column_collection_of_bools_Contains(bool async)
|
|
{
|
|
await base.Column_collection_of_bools_Contains(async);
|
|
}
|
|
|
|
[ConditionalFact]
|
|
public virtual async Task Json_representation_of_bool_array()
|
|
{
|
|
await using var context = CreateContext();
|
|
|
|
Assert.Equal(
|
|
"[true,false]",
|
|
await context.Database.SqlQuery<string>($"SELECT [Bools] AS [Value] FROM [PrimitiveCollectionsEntity] WHERE [Id] = 1").SingleAsync());
|
|
}
|
|
|
|
public override async Task Column_collection_Count_method(bool async)
|
|
{
|
|
await base.Column_collection_Count_method(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Length(bool async)
|
|
{
|
|
await base.Column_collection_Length(async);
|
|
}
|
|
|
|
public override async Task Column_collection_index_int(bool async)
|
|
{
|
|
await base.Column_collection_index_int(async);
|
|
}
|
|
|
|
public override async Task Column_collection_index_string(bool async)
|
|
{
|
|
await base.Column_collection_index_string(async);
|
|
}
|
|
|
|
public override async Task Column_collection_index_datetime(bool async)
|
|
{
|
|
await base.Column_collection_index_datetime(async);
|
|
}
|
|
|
|
public override async Task Column_collection_index_beyond_end(bool async)
|
|
{
|
|
await base.Column_collection_index_beyond_end(async);
|
|
}
|
|
|
|
public override async Task Nullable_reference_column_collection_index_equals_nullable_column(bool async)
|
|
{
|
|
await base.Column_collection_index_beyond_end(async);
|
|
}
|
|
|
|
public override async Task Non_nullable_reference_column_collection_index_equals_nullable_column(bool async)
|
|
{
|
|
await base.Column_collection_index_beyond_end(async);
|
|
}
|
|
|
|
public override async Task Inline_collection_index_Column(bool async)
|
|
{
|
|
await base.Inline_collection_index_Column(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
|
|
FROM [PrimitiveCollectionsEntity] AS [p]
|
|
WHERE (
|
|
SELECT [v].[Value]
|
|
FROM (VALUES (0, CAST(1 AS int)), (1, 2), (2, 3)) AS [v]([_ord], [Value])
|
|
ORDER BY [v].[_ord]
|
|
OFFSET [p].[Int] ROWS FETCH NEXT 1 ROWS ONLY) = 1
|
|
""");
|
|
}
|
|
|
|
public override async Task Parameter_collection_index_Column_equal_Column(bool async)
|
|
{
|
|
await base.Parameter_collection_index_Column_equal_Column(async);
|
|
}
|
|
|
|
public override async Task Parameter_collection_index_Column_equal_constant(bool async)
|
|
{
|
|
await base.Parameter_collection_index_Column_equal_constant(async);
|
|
}
|
|
|
|
public override async Task Column_collection_ElementAt(bool async)
|
|
{
|
|
await base.Column_collection_ElementAt(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Skip(bool async)
|
|
{
|
|
await base.Column_collection_Skip(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Take(bool async)
|
|
{
|
|
await base.Column_collection_Take(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Skip_Take(bool async)
|
|
{
|
|
await base.Column_collection_Skip_Take(async);
|
|
}
|
|
|
|
public override async Task Column_collection_OrderByDescending_ElementAt(bool async)
|
|
{
|
|
await base.Column_collection_OrderByDescending_ElementAt(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Any(bool async)
|
|
{
|
|
await base.Column_collection_Any(async);
|
|
}
|
|
|
|
public override Task Column_collection_Distinct(bool async)
|
|
=> AssertTranslationFailed(() => base.Column_collection_Distinct(async));
|
|
|
|
public override async Task Column_collection_projection_from_top_level(bool async)
|
|
{
|
|
await base.Column_collection_projection_from_top_level(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Ints`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
ORDER BY `p`.`Id`
|
|
""");
|
|
}
|
|
|
|
public override Task Column_collection_Join_parameter_collection(bool async)
|
|
=> AssertTranslationFailed(() => base.Column_collection_Join_parameter_collection(async));
|
|
|
|
public override async Task Inline_collection_Join_ordered_column_collection(bool async)
|
|
{
|
|
await base.Inline_collection_Join_ordered_column_collection(async);
|
|
}
|
|
|
|
public override async Task Parameter_collection_Concat_column_collection(bool async)
|
|
{
|
|
await base.Parameter_collection_Concat_column_collection(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Union_parameter_collection(bool async)
|
|
{
|
|
await base.Column_collection_Union_parameter_collection(async);
|
|
}
|
|
|
|
public override async Task Column_collection_Intersect_inline_collection(bool async)
|
|
{
|
|
await base.Column_collection_Intersect_inline_collection(async);
|
|
}
|
|
|
|
public override async Task Inline_collection_Except_column_collection(bool async)
|
|
{
|
|
await base.Inline_collection_Except_column_collection(async);
|
|
}
|
|
|
|
public override async Task Column_collection_equality_parameter_collection(bool async)
|
|
{
|
|
await base.Column_collection_equality_parameter_collection(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
@__ints_0='[1,10]' (Size = 255)
|
|
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Ints` = @__ints_0
|
|
""");
|
|
}
|
|
|
|
public override async Task Column_collection_Concat_parameter_collection_equality_inline_collection(bool async)
|
|
{
|
|
await base.Column_collection_Concat_parameter_collection_equality_inline_collection(async);
|
|
|
|
AssertSql();
|
|
}
|
|
|
|
public override async Task Column_collection_equality_inline_collection(bool async)
|
|
{
|
|
await base.Column_collection_equality_inline_collection(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Ints` = '[1,10]'
|
|
""");
|
|
}
|
|
|
|
public override async Task Column_collection_equality_inline_collection_with_parameters(bool async)
|
|
{
|
|
await base.Column_collection_equality_inline_collection_with_parameters(async);
|
|
|
|
AssertSql();
|
|
}
|
|
|
|
public override async Task Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(bool async)
|
|
{
|
|
await base.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(async);
|
|
}
|
|
|
|
public override async Task Parameter_collection_in_subquery_Union_column_collection(bool async)
|
|
{
|
|
await base.Parameter_collection_in_subquery_Union_column_collection(async);
|
|
}
|
|
|
|
public override async Task Parameter_collection_in_subquery_Union_column_collection_nested(bool async)
|
|
{
|
|
await base.Parameter_collection_in_subquery_Union_column_collection_nested(async);
|
|
}
|
|
|
|
public override void Parameter_collection_in_subquery_and_Convert_as_compiled_query()
|
|
{
|
|
// Base implementation asserts that a different exception is thrown
|
|
}
|
|
|
|
public override Task Parameter_collection_in_subquery_Count_as_compiled_query(bool async)
|
|
=> AssertTranslationFailed(() => base.Parameter_collection_in_subquery_Count_as_compiled_query(async));
|
|
|
|
public override async Task Column_collection_in_subquery_Union_parameter_collection(bool async)
|
|
{
|
|
await base.Column_collection_in_subquery_Union_parameter_collection(async);
|
|
}
|
|
|
|
public override async Task Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(
|
|
bool async)
|
|
{
|
|
await base.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(async);
|
|
}
|
|
|
|
public override async Task Project_collection_of_ints_simple(bool async)
|
|
{
|
|
await base.Project_collection_of_ints_simple(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Ints`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
ORDER BY `p`.`Id`
|
|
""");
|
|
}
|
|
|
|
public override Task Project_collection_of_ints_ordered(bool async)
|
|
// we don't propagate error details from projection
|
|
=> AssertTranslationFailed(() => base.Project_collection_of_ints_ordered(async));
|
|
|
|
public override Task Project_collection_of_datetimes_filtered(bool async)
|
|
// we don't propagate error details from projection
|
|
=> AssertTranslationFailed(() => base.Project_collection_of_datetimes_filtered(async));
|
|
|
|
public override async Task Project_collection_of_nullable_ints_with_paging(bool async)
|
|
{
|
|
await base.Project_collection_of_nullable_ints_with_paging(async);
|
|
|
|
// client eval
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`NullableInts`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
ORDER BY `p`.`Id`
|
|
""");
|
|
}
|
|
|
|
public override Task Project_collection_of_nullable_ints_with_paging2(bool async)
|
|
// we don't propagate error details from projection
|
|
=> AssertTranslationFailed(() => base.Project_collection_of_nullable_ints_with_paging2(async));
|
|
|
|
public override async Task Project_collection_of_nullable_ints_with_paging3(bool async)
|
|
{
|
|
await base.Project_collection_of_nullable_ints_with_paging3(async);
|
|
|
|
// client eval
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`NullableInts`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
ORDER BY `p`.`Id`
|
|
""");
|
|
}
|
|
|
|
public override async Task Project_collection_of_ints_with_distinct(bool async)
|
|
{
|
|
await base.Project_collection_of_ints_with_distinct(async);
|
|
|
|
// client eval
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Ints`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
ORDER BY `p`.`Id`
|
|
""");
|
|
}
|
|
|
|
public override async Task Project_collection_of_nullable_ints_with_distinct(bool async)
|
|
{
|
|
await base.Project_collection_of_nullable_ints_with_distinct(async);
|
|
|
|
AssertSql("");
|
|
}
|
|
|
|
public override Task Project_multiple_collections(bool async)
|
|
// we don't propagate error details from projection
|
|
=> AssertTranslationFailed(() => base.Project_multiple_collections(async));
|
|
|
|
public override Task Project_empty_collection_of_nullables_and_collection_only_containing_nulls(bool async)
|
|
// we don't propagate error details from projection
|
|
=> AssertTranslationFailed(() => base.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async));
|
|
|
|
public override async Task Project_primitive_collections_element(bool async)
|
|
{
|
|
await base.Project_primitive_collections_element(async);
|
|
|
|
AssertSql(
|
|
"""
|
|
SELECT `p`.`Ints`, `p`.`DateTimes`, `p`.`Strings`
|
|
FROM `PrimitiveCollectionsEntity` AS `p`
|
|
WHERE `p`.`Id` < 4
|
|
ORDER BY `p`.`Id`
|
|
""");
|
|
}
|
|
|
|
[ConditionalFact]
|
|
public virtual void Check_all_tests_overridden()
|
|
=> TestHelpers.AssertAllMethodsOverridden(GetType());
|
|
|
|
private void AssertSql(params string[] expected)
|
|
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
|
|
|
|
private PrimitiveCollectionsContext CreateContext()
|
|
=> Fixture.CreateContext();
|
|
|
|
public class PrimitiveCollectionsQueryJetFixture : PrimitiveCollectionsQueryFixtureBase
|
|
{
|
|
protected override string StoreName
|
|
=> "PrimitiveCollectionsTest";
|
|
|
|
public TestSqlLoggerFactory TestSqlLoggerFactory
|
|
=> (TestSqlLoggerFactory)ListLoggerFactory;
|
|
|
|
protected override ITestStoreFactory TestStoreFactory
|
|
=> JetTestStoreFactory.Instance;
|
|
}
|
|
}
|