-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
452 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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
85 changes: 85 additions & 0 deletions
85
test/EFCore.PG.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesNpgsqlTest.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,85 @@ | ||
using Microsoft.EntityFrameworkCore.BulkUpdates; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Query; | ||
|
||
namespace Npgsql.EntityFrameworkCore.PostgreSQL.BulkUpdates; | ||
|
||
public class TPCFiltersInheritanceBulkUpdatesNpgsqlTest : TPCFiltersInheritanceBulkUpdatesTestBase<TPCFiltersInheritanceQueryNpgsqlFixture> | ||
{ | ||
public TPCFiltersInheritanceBulkUpdatesNpgsqlTest(TPCFiltersInheritanceQueryNpgsqlFixture fixture) | ||
: base(fixture) | ||
{ | ||
ClearLog(); | ||
} | ||
|
||
[ConditionalFact] | ||
public virtual void Check_all_tests_overridden() | ||
=> TestHelpers.AssertAllMethodsOverridden(GetType()); | ||
|
||
public override async Task Delete_where_hierarchy(bool async) | ||
{ | ||
await base.Delete_where_hierarchy(async); | ||
|
||
AssertSql(); | ||
} | ||
|
||
public override async Task Delete_where_hierarchy_derived(bool async) | ||
{ | ||
await base.Delete_where_hierarchy_derived(async); | ||
|
||
AssertSql( | ||
@"DELETE FROM ""Kiwi"" AS k | ||
WHERE k.""CountryId"" = 1 AND k.""Name"" = 'Great spotted kiwi'"); | ||
} | ||
|
||
public override async Task Delete_where_using_hierarchy(bool async) | ||
{ | ||
await base.Delete_where_using_hierarchy(async); | ||
|
||
AssertSql( | ||
@"DELETE FROM ""Countries"" AS c | ||
WHERE ( | ||
SELECT count(*)::int | ||
FROM ( | ||
SELECT e.""Id"", e.""CountryId"", e.""Name"", e.""Species"", e.""EagleId"", e.""IsFlightless"", e.""Group"", NULL AS ""FoundOn"", 'Eagle' AS ""Discriminator"" | ||
FROM ""Eagle"" AS e | ||
UNION ALL | ||
SELECT k.""Id"", k.""CountryId"", k.""Name"", k.""Species"", k.""EagleId"", k.""IsFlightless"", NULL AS ""Group"", k.""FoundOn"", 'Kiwi' AS ""Discriminator"" | ||
FROM ""Kiwi"" AS k | ||
) AS t | ||
WHERE t.""CountryId"" = 1 AND c.""Id"" = t.""CountryId"" AND t.""CountryId"" > 0) > 0"); | ||
} | ||
|
||
public override async Task Delete_where_using_hierarchy_derived(bool async) | ||
{ | ||
await base.Delete_where_using_hierarchy_derived(async); | ||
|
||
AssertSql( | ||
@"DELETE FROM ""Countries"" AS c | ||
WHERE ( | ||
SELECT count(*)::int | ||
FROM ( | ||
SELECT k.""Id"", k.""CountryId"", k.""Name"", k.""Species"", k.""EagleId"", k.""IsFlightless"", NULL AS ""Group"", k.""FoundOn"", 'Kiwi' AS ""Discriminator"" | ||
FROM ""Kiwi"" AS k | ||
) AS t | ||
WHERE t.""CountryId"" = 1 AND c.""Id"" = t.""CountryId"" AND t.""CountryId"" > 0) > 0"); | ||
} | ||
|
||
public override async Task Delete_where_keyless_entity_mapped_to_sql_query(bool async) | ||
{ | ||
await base.Delete_where_keyless_entity_mapped_to_sql_query(async); | ||
|
||
AssertSql(); | ||
} | ||
|
||
public override async Task Delete_where_hierarchy_subquery(bool async) | ||
{ | ||
await base.Delete_where_hierarchy_subquery(async); | ||
|
||
AssertSql(); | ||
} | ||
|
||
protected override void ClearLog() => Fixture.TestSqlLoggerFactory.Clear(); | ||
|
||
private void AssertSql(params string[] expected) | ||
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected); | ||
} |
86 changes: 86 additions & 0 deletions
86
test/EFCore.PG.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesNpgsqlTest.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,86 @@ | ||
using Microsoft.EntityFrameworkCore.BulkUpdates; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Query; | ||
|
||
namespace Npgsql.EntityFrameworkCore.PostgreSQL.BulkUpdates; | ||
|
||
public class TPCInheritanceBulkUpdatesNpgsqlTest : TPCInheritanceBulkUpdatesTestBase<TPCInheritanceQueryNpgsqlFixture> | ||
{ | ||
public TPCInheritanceBulkUpdatesNpgsqlTest(TPCInheritanceQueryNpgsqlFixture fixture) | ||
: base(fixture) | ||
{ | ||
ClearLog(); | ||
} | ||
|
||
[ConditionalFact] | ||
public virtual void Check_all_tests_overridden() | ||
=> TestHelpers.AssertAllMethodsOverridden(GetType()); | ||
|
||
public override async Task Delete_where_hierarchy(bool async) | ||
{ | ||
await base.Delete_where_hierarchy(async); | ||
|
||
AssertSql(); | ||
} | ||
|
||
public override async Task Delete_where_hierarchy_derived(bool async) | ||
{ | ||
await base.Delete_where_hierarchy_derived(async); | ||
|
||
AssertSql( | ||
@"DELETE FROM ""Kiwi"" AS k | ||
WHERE k.""Name"" = 'Great spotted kiwi'"); | ||
} | ||
|
||
public override async Task Delete_where_using_hierarchy(bool async) | ||
{ | ||
await base.Delete_where_using_hierarchy(async); | ||
|
||
AssertSql( | ||
@"DELETE FROM ""Countries"" AS c | ||
WHERE ( | ||
SELECT count(*)::int | ||
FROM ( | ||
SELECT e.""Id"", e.""CountryId"", e.""Name"", e.""Species"", e.""EagleId"", e.""IsFlightless"", e.""Group"", NULL AS ""FoundOn"", 'Eagle' AS ""Discriminator"" | ||
FROM ""Eagle"" AS e | ||
UNION ALL | ||
SELECT k.""Id"", k.""CountryId"", k.""Name"", k.""Species"", k.""EagleId"", k.""IsFlightless"", NULL AS ""Group"", k.""FoundOn"", 'Kiwi' AS ""Discriminator"" | ||
FROM ""Kiwi"" AS k | ||
) AS t | ||
WHERE c.""Id"" = t.""CountryId"" AND t.""CountryId"" > 0) > 0"); | ||
} | ||
|
||
public override async Task Delete_where_using_hierarchy_derived(bool async) | ||
{ | ||
await base.Delete_where_using_hierarchy_derived(async); | ||
|
||
AssertSql( | ||
@"DELETE FROM ""Countries"" AS c | ||
WHERE ( | ||
SELECT count(*)::int | ||
FROM ( | ||
SELECT k.""Id"", k.""CountryId"", k.""Name"", k.""Species"", k.""EagleId"", k.""IsFlightless"", NULL AS ""Group"", k.""FoundOn"", 'Kiwi' AS ""Discriminator"" | ||
FROM ""Kiwi"" AS k | ||
) AS t | ||
WHERE c.""Id"" = t.""CountryId"" AND t.""CountryId"" > 0) > 0"); | ||
} | ||
|
||
public override async Task Delete_where_keyless_entity_mapped_to_sql_query(bool async) | ||
{ | ||
await base.Delete_where_keyless_entity_mapped_to_sql_query(async); | ||
|
||
AssertSql(); | ||
} | ||
|
||
public override async Task Delete_where_hierarchy_subquery(bool async) | ||
{ | ||
await base.Delete_where_hierarchy_subquery(async); | ||
|
||
AssertSql(); | ||
} | ||
|
||
protected override void ClearLog() => Fixture.TestSqlLoggerFactory.Clear(); | ||
|
||
private void AssertSql(params string[] expected) | ||
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected); | ||
} | ||
|
Oops, something went wrong.