-
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.
Query: Add TPT variant for GearsOfWarQueryTests (#21532)
Part of #21510
- Loading branch information
Showing
9 changed files
with
9,140 additions
and
10 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
test/EFCore.Relational.Specification.Tests/Query/TPTGearsOfWarQueryRelationalFixture.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,33 @@ | ||
// 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 Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class TPTGearsOfWarQueryRelationalFixture : GearsOfWarQueryFixtureBase | ||
{ | ||
protected override string StoreName { get; } = "TPTGearsOfWarQueryTest"; | ||
public new RelationalTestStore TestStore => (RelationalTestStore)base.TestStore; | ||
|
||
public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; | ||
|
||
protected override bool ShouldLogCategory(string logCategory) | ||
=> logCategory == DbLoggerCategory.Query.Name; | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
|
||
modelBuilder.Entity<Gear>().ToTable("Gears"); | ||
modelBuilder.Entity<Officer>().ToTable("Officers"); | ||
|
||
modelBuilder.Entity<Faction>().ToTable("Factions"); | ||
modelBuilder.Entity<LocustHorde>().ToTable("LocustHordes"); | ||
|
||
modelBuilder.Entity<LocustLeader>().ToTable("LocustLeaders"); | ||
modelBuilder.Entity<LocustCommander>().ToTable("LocustCommanders"); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
test/EFCore.Relational.Specification.Tests/Query/TPTGearsOfWarQueryRelationalTestBase.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 TPTGearsOfWarQueryRelationalTestBase<TFixture> : GearsOfWarQueryRelationalTestBase<TFixture> | ||
where TFixture : TPTGearsOfWarQueryRelationalFixture, new() | ||
{ | ||
protected TPTGearsOfWarQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.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
20 changes: 20 additions & 0 deletions
20
test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerFixture.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 Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class TPTGearsOfWarQuerySqlServerFixture : TPTGearsOfWarQueryRelationalFixture | ||
{ | ||
protected override ITestStoreFactory TestStoreFactory => SqlServerTestStoreFactory.Instance; | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
|
||
modelBuilder.Entity<City>().Property(g => g.Location).HasColumnType("varchar(100)"); | ||
} | ||
} | ||
} |
8,840 changes: 8,840 additions & 0 deletions
8,840
test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
12 changes: 12 additions & 0 deletions
12
test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteFixture.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,12 @@ | ||
// 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 Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class TPTGearsOfWarQuerySqliteFixture : TPTGearsOfWarQueryRelationalFixture | ||
{ | ||
protected override ITestStoreFactory TestStoreFactory => SqliteTestStoreFactory.Instance; | ||
} | ||
} |
212 changes: 212 additions & 0 deletions
212
test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.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,212 @@ | ||
// 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.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class TPTGearsOfWarQuerySqliteTest : TPTGearsOfWarQueryRelationalTestBase<TPTGearsOfWarQuerySqliteFixture> | ||
{ | ||
public TPTGearsOfWarQuerySqliteTest(TPTGearsOfWarQuerySqliteFixture fixture, ITestOutputHelper testOutputHelper) | ||
: base(fixture) | ||
{ | ||
Fixture.TestSqlLoggerFactory.Clear(); | ||
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); | ||
} | ||
|
||
public override Task Where_datetimeoffset_date_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_date_component(async)); | ||
|
||
public override Task Where_datetimeoffset_day_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_date_component(async)); | ||
|
||
public override Task Where_datetimeoffset_dayofyear_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_dayofyear_component(async)); | ||
|
||
public override Task Where_datetimeoffset_hour_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_hour_component(async)); | ||
|
||
public override Task Where_datetimeoffset_millisecond_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_millisecond_component(async)); | ||
|
||
public override Task Where_datetimeoffset_minute_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_minute_component(async)); | ||
|
||
public override Task Where_datetimeoffset_month_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_month_component(async)); | ||
|
||
public override Task Where_datetimeoffset_now(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_now(async)); | ||
|
||
public override Task Where_datetimeoffset_second_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_second_component(async)); | ||
|
||
public override Task Where_datetimeoffset_utcnow(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_utcnow(async)); | ||
|
||
public override Task Where_datetimeoffset_year_component(bool async) | ||
=> AssertTranslationFailed(() => base.Where_datetimeoffset_year_component(async)); | ||
|
||
public override Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) | ||
=> AssertTranslationFailed(() => base.DateTimeOffset_Contains_Less_than_Greater_than(async)); | ||
|
||
public override Task DateTimeOffset_Date_returns_datetime(bool async) | ||
=> AssertTranslationFailed(() => base.DateTimeOffset_Date_returns_datetime(async)); | ||
|
||
// Sqlite does not support cross/outer apply | ||
public override Task Correlated_collections_inner_subquery_predicate_references_outer_qsre(bool async) => null; | ||
|
||
public override Task Correlated_collections_inner_subquery_selector_references_outer_qsre(bool async) => null; | ||
|
||
public override Task Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(bool async) => null; | ||
|
||
public override Task Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(bool async) => null; | ||
|
||
public override Task Outer_parameter_in_group_join_with_DefaultIfEmpty(bool async) => null; | ||
|
||
public override Task Outer_parameter_in_join_key(bool async) => null; | ||
|
||
public override Task Outer_parameter_in_join_key_inner_and_outer(bool async) => null; | ||
|
||
public override Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(bool async) => null; | ||
|
||
public override Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(bool async) => null; | ||
|
||
public override Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion(bool async) => null; | ||
|
||
public override Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated(bool async) => null; | ||
|
||
public override async Task Negate_on_binary_expression(bool async) | ||
{ | ||
await base.Negate_on_binary_expression(async); | ||
|
||
AssertSql( | ||
@"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE ""s"".""Id"" = -(""s"".""Id"" + ""s"".""Id"")"); | ||
} | ||
|
||
public override async Task Negate_on_column(bool async) | ||
{ | ||
await base.Negate_on_column(async); | ||
|
||
AssertSql( | ||
@"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE ""s"".""Id"" = -""s"".""Id"""); | ||
} | ||
|
||
public override async Task Negate_on_like_expression(bool async) | ||
{ | ||
await base.Negate_on_like_expression(async); | ||
|
||
AssertSql( | ||
@"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE ""s"".""Name"" IS NOT NULL AND NOT (""s"".""Name"" LIKE 'us%')"); | ||
} | ||
|
||
public override async Task Select_datetimeoffset_comparison_in_projection(bool async) | ||
{ | ||
await base.Select_datetimeoffset_comparison_in_projection(async); | ||
|
||
AssertSql( | ||
@"SELECT ""m"".""Timeline"" | ||
FROM ""Missions"" AS ""m"""); | ||
} | ||
|
||
public override async Task Byte_array_contains_literal(bool async) | ||
{ | ||
await base.Byte_array_contains_literal(async); | ||
|
||
AssertSql( | ||
@"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE instr(""s"".""Banner"", X'01') > 0"); | ||
} | ||
|
||
public override async Task Byte_array_contains_parameter(bool async) | ||
{ | ||
await base.Byte_array_contains_parameter(async); | ||
|
||
AssertSql( | ||
@"@__someByte_0='1' (DbType = String) | ||
SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE instr(""s"".""Banner"", char(@__someByte_0)) > 0"); | ||
} | ||
|
||
public override async Task Byte_array_filter_by_length_literal(bool async) | ||
{ | ||
await base.Byte_array_filter_by_length_literal(async); | ||
|
||
AssertSql(@"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE length(""s"".""Banner"") = 1"); | ||
} | ||
|
||
public override async Task Byte_array_filter_by_length_parameter(bool async) | ||
{ | ||
await base.Byte_array_filter_by_length_parameter(async); | ||
|
||
AssertSql(@"@__p_0='1' (DbType = String) | ||
SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE length(""s"".""Banner"") = @__p_0"); | ||
} | ||
|
||
public override void Byte_array_filter_by_length_parameter_compiled() | ||
{ | ||
base.Byte_array_filter_by_length_parameter_compiled(); | ||
|
||
AssertSql( | ||
@"@__byteArrayParam='0x2A80' (Size = 2) (DbType = String) | ||
SELECT COUNT(*) | ||
FROM ""Squads"" AS ""s"" | ||
WHERE length(""s"".""Banner"") = length(@__byteArrayParam)"); | ||
} | ||
|
||
public override async Task Byte_array_filter_by_SequenceEqual(bool async) | ||
{ | ||
await base.Byte_array_filter_by_SequenceEqual(async); | ||
|
||
AssertSql(@"@__byteArrayParam_0='0x0405060708' (Size = 5) (DbType = String) | ||
SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" | ||
FROM ""Squads"" AS ""s"" | ||
WHERE ""s"".""Banner5"" = @__byteArrayParam_0"); | ||
} | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task TimeSpan_Hours(bool async) => base.TimeSpan_Hours(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task TimeSpan_Minutes(bool async) => base.TimeSpan_Minutes(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task TimeSpan_Seconds(bool async) => base.TimeSpan_Seconds(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task TimeSpan_Milliseconds(bool async) => base.TimeSpan_Milliseconds(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task Where_TimeSpan_Hours(bool async) => base.Where_TimeSpan_Hours(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task Where_TimeSpan_Minutes(bool async) => base.Where_TimeSpan_Minutes(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task Where_TimeSpan_Seconds(bool async) => base.Where_TimeSpan_Seconds(async); | ||
|
||
[ConditionalTheory(Skip = "Issue#18844")] | ||
public override Task Where_TimeSpan_Milliseconds(bool async) => base.Where_TimeSpan_Milliseconds(async); | ||
|
||
private void AssertSql(params string[] expected) | ||
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected); | ||
} | ||
} |