diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68516ac816..628f5b935b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,7 +112,7 @@ jobs: shell: bash - name: Test - run: dotnet test -c ${{ matrix.config }} --logger "GitHubActions;report-warnings=false" + run: dotnet test -c ${{ matrix.config }} -- --no-progress shell: bash env: # Disable SSL to avoid unnecessary handshake pressure in the Windows functional tests. diff --git a/Directory.Packages.props b/Directory.Packages.props index 639edd539c..e7df232038 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,8 +1,8 @@ - 11.0.0-preview.5.26267.102 - 11.0.0-preview.5.26267.102 - 11.0.0-preview.5.26267.102 + 11.0.0-preview.5.26275.101 + 11.0.0-preview.5.26275.101 + 11.0.0-preview.5.26275.101 10.0.0 @@ -28,6 +28,7 @@ + diff --git a/NuGet.config b/NuGet.config index 98c370333c..12be56142c 100644 --- a/NuGet.config +++ b/NuGet.config @@ -21,6 +21,9 @@ + + + diff --git a/global.json b/global.json index 973ee8c8d8..4c949e8da4 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "11.0.100-preview.4.26210.111", "rollForward": "latestMinor", "allowPrerelease": true + }, + "test": { + "runner": "Microsoft.Testing.Platform" } } diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs index c8bab43fe2..dd3ea48176 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs @@ -18,6 +18,7 @@ public class NpgsqlMathTranslator( IModel model) : IMethodCallTranslator { private readonly RelationalTypeMapping _intTypeMapping = typeMappingSource.FindMapping(typeof(int), model)!; + private readonly RelationalTypeMapping _doubleTypeMapping = typeMappingSource.FindMapping(typeof(double), model)!; private readonly RelationalTypeMapping _decimalTypeMapping = typeMappingSource.FindMapping(typeof(decimal), model)!; /// @@ -226,7 +227,8 @@ SqlExpression TranslateSign(SqlExpression argument) [argument], nullable: true, argumentsPropagateNullability: TrueArrays[1], - method.ReturnType), + argument.Type == typeof(decimal) ? typeof(decimal) : typeof(double), + argument.Type == typeof(decimal) ? argument.TypeMapping : _doubleTypeMapping), typeof(int), _intTypeMapping); } diff --git a/test/Directory.Build.props b/test/Directory.Build.props index b4dbbaa8a6..29fde2d016 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -5,14 +5,21 @@ false false + true - $(NoWarn);xUnit1003;xUnit1004;xUnit1013;xUnit1024;EF1001 + $(NoWarn);CS0618;xUnit1003;xUnit1004;xUnit1008;xUnit1013;xUnit1024;xUnit1051;EF1001 + + + + Exe + XUnitV3 + $(TestingPlatformCommandLineArguments) --filter-not-trait category=failing --ignore-exit-code 8 - + @@ -24,7 +31,6 @@ - diff --git a/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs index ff669fcb64..4a22ecd807 100644 --- a/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.ComponentModel.DataAnnotations.Schema; using System.Net.NetworkInformation; @@ -719,7 +719,7 @@ private static void AssertNullMappedNullableDataTypes(MappedNullableDataTypes en Assert.Null(entity.Mood); } - [ConditionalFact(Skip = "DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")] + [ActiveIssue("DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")] public override Task Can_insert_and_read_back_object_backed_data_types() => Task.CompletedTask; diff --git a/test/EFCore.PG.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesNpgsqlTest.cs index ba1fce5126..4907a97587 100644 --- a/test/EFCore.PG.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesNpgsqlTest.cs @@ -1407,7 +1407,6 @@ WHERE c."CustomerID" LIKE 'F%' """); } - [ConditionalTheory] public override async Task Update_with_cross_join_left_join_set_constant(bool async) { await base.Update_with_cross_join_left_join_set_constant(async); @@ -1437,7 +1436,6 @@ WHERE c."CustomerID" LIKE 'F%' """); } - [ConditionalTheory] public override async Task Update_with_cross_join_cross_apply_set_constant(bool async) { await base.Update_with_cross_join_cross_apply_set_constant(async); @@ -1467,7 +1465,6 @@ WHERE c."CustomerID" LIKE 'F%' """); } - [ConditionalTheory] public override async Task Update_with_cross_join_outer_apply_set_constant(bool async) { await base.Update_with_cross_join_outer_apply_set_constant(async); @@ -1577,7 +1574,6 @@ WHERE c."CustomerID" LIKE 'F%' """); } - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public override async Task Update_with_two_inner_joins(bool async) { diff --git a/test/EFCore.PG.FunctionalTests/ComputedColumnTest.cs b/test/EFCore.PG.FunctionalTests/ComputedColumnTest.cs index 46de11410b..33ca759145 100644 --- a/test/EFCore.PG.FunctionalTests/ComputedColumnTest.cs +++ b/test/EFCore.PG.FunctionalTests/ComputedColumnTest.cs @@ -134,9 +134,9 @@ public void Can_use_computed_columns_with_nullable_enum() protected NpgsqlTestStore TestStore { get; private set; } = null!; - public async Task InitializeAsync() + public async ValueTask InitializeAsync() => TestStore = await NpgsqlTestStore.CreateInitializedAsync("ComputedColumnTest"); - public async Task DisposeAsync() + public async ValueTask DisposeAsync() => await TestStore.DisposeAsync(); } diff --git a/test/EFCore.PG.FunctionalTests/ConnectionInterceptionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/ConnectionInterceptionNpgsqlTest.cs index ad7b852f13..d9cc6c28d4 100644 --- a/test/EFCore.PG.FunctionalTests/ConnectionInterceptionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/ConnectionInterceptionNpgsqlTest.cs @@ -7,19 +7,19 @@ namespace Microsoft.EntityFrameworkCore; public abstract class ConnectionInterceptionNpgsqlTestBase(ConnectionInterceptionNpgsqlTestBase.InterceptionNpgsqlFixtureBase fixture) : ConnectionInterceptionTestBase(fixture) { - [ConditionalTheory(Skip = "#2368")] + [ActiveIssue("#2368")] public override Task Intercept_connection_creation_passively(bool async) => base.Intercept_connection_creation_passively(async); - [ConditionalTheory(Skip = "#2368")] + [ActiveIssue("#2368")] public override Task Intercept_connection_creation_with_multiple_interceptors(bool async) => base.Intercept_connection_creation_with_multiple_interceptors(async); - [ConditionalTheory(Skip = "#2368")] + [ActiveIssue("#2368")] public override Task Intercept_connection_to_override_connection_after_creation(bool async) => base.Intercept_connection_to_override_connection_after_creation(async); - [ConditionalTheory(Skip = "#2368")] + [ActiveIssue("#2368")] public override Task Intercept_connection_to_override_creation(bool async) => base.Intercept_connection_to_override_creation(async); diff --git a/test/EFCore.PG.FunctionalTests/ConvertToProviderTypesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/ConvertToProviderTypesNpgsqlTest.cs index 9196dc66f4..c265f96ce9 100644 --- a/test/EFCore.PG.FunctionalTests/ConvertToProviderTypesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/ConvertToProviderTypesNpgsqlTest.cs @@ -1,4 +1,4 @@ -namespace Microsoft.EntityFrameworkCore; +namespace Microsoft.EntityFrameworkCore; public class ConvertToProviderTypesNpgsqlTest : ConvertToProviderTypesTestBase< ConvertToProviderTypesNpgsqlTest.ConvertToProviderTypesNpgsqlFixture> @@ -49,7 +49,7 @@ public ConvertToProviderTypesNpgsqlTest(ConvertToProviderTypesNpgsqlFixture fixt // } // } - [ConditionalFact(Skip = "DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")] + [ActiveIssue("DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")] public override Task Can_insert_and_read_back_object_backed_data_types() => Task.CompletedTask; diff --git a/test/EFCore.PG.FunctionalTests/CustomConvertersNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/CustomConvertersNpgsqlTest.cs index e7571d81c9..170abf3666 100644 --- a/test/EFCore.PG.FunctionalTests/CustomConvertersNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/CustomConvertersNpgsqlTest.cs @@ -1,4 +1,4 @@ -namespace Microsoft.EntityFrameworkCore; +namespace Microsoft.EntityFrameworkCore; public class CustomConvertersNpgsqlTest(CustomConvertersNpgsqlTest.CustomConvertersNpgsqlFixture fixture) : CustomConvertersTestBase(fixture) @@ -7,7 +7,7 @@ public class CustomConvertersNpgsqlTest(CustomConvertersNpgsqlTest.CustomConvert public override Task Can_insert_and_read_back_with_case_insensitive_string_key() => Task.CompletedTask; - [ConditionalFact(Skip = "DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")] + [ActiveIssue("DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")] public override Task Can_insert_and_read_back_object_backed_data_types() => Task.CompletedTask; diff --git a/test/EFCore.PG.FunctionalTests/JsonTypesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/JsonTypesNpgsqlTest.cs index 7446bed8cd..d47db88de4 100644 --- a/test/EFCore.PG.FunctionalTests/JsonTypesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/JsonTypesNpgsqlTest.cs @@ -210,7 +210,6 @@ protected class NpgsqlDateOnlyCollectionType public List DateOnly { get; set; } = null!; } - [ConditionalFact] public override Task Can_read_write_collection_of_nullable_DateOnly_JSON_values() => Can_read_and_write_JSON_value>( nameof(NullableDateOnlyCollectionType.DateOnly), @@ -462,7 +461,6 @@ public virtual Task Can_read_write_LogSequenceNumber_JSON_values(ulong value, st new NpgsqlLogSequenceNumber(value), json); - [ConditionalFact] public override async Task Can_read_write_point() { var factory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326); @@ -480,7 +478,6 @@ public virtual async Task Can_read_write_point_without_SRID() new Point(2, 4), """{"Prop":"POINT (2 4)"}"""); - [ConditionalFact] public override async Task Can_read_write_point_with_M() { var factory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326); @@ -511,7 +508,6 @@ await Can_read_and_write_JSON_value( """{"Prop":"SRID=4326;POINT Z(1 2 3)"}"""); } - [ConditionalFact] public override async Task Can_read_write_line_string() { var factory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326); diff --git a/test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs index 0f8199dd74..2b7a5be9ad 100644 --- a/test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs @@ -1,4 +1,4 @@ -using Xunit.Sdk; +using Xunit.Sdk; namespace Microsoft.EntityFrameworkCore; @@ -15,10 +15,9 @@ public LazyLoadProxyNpgsqlTest(LoadNpgsqlFixture fixture) public override void Can_serialize_proxies_to_JSON() => Assert.Throws(base.Can_serialize_proxies_to_JSON); - [ConditionalFact] // Requires MARS public override void Top_level_projection_track_entities_before_passing_to_client_method() { } - [ConditionalTheory(Skip = "Possibly requires MARS, investigate")] + [ActiveIssue("Possibly requires MARS, investigate")] public override void Lazy_load_one_to_one_reference_with_recursive_property(EntityState state) => base.Lazy_load_one_to_one_reference_with_recursive_property(state); diff --git a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs index 00a911ec8a..6c58e200f9 100644 --- a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs @@ -1,4 +1,4 @@ -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal; namespace Microsoft.EntityFrameworkCore.Migrations; @@ -29,23 +29,23 @@ public override Task Can_apply_two_migrations_in_transaction_async() public override Task Can_generate_no_migration_script() => base.Can_generate_no_migration_script(); - [ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/33056")] public override void Can_apply_all_migrations() => base.Can_apply_all_migrations(); - [ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/33056")] public override void Can_apply_range_of_migrations() => base.Can_apply_range_of_migrations(); - [ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/33056")] public override void Can_revert_all_migrations() => base.Can_revert_all_migrations(); - [ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/33056")] public override void Can_revert_one_migrations() => base.Can_revert_one_migrations(); - [ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/33056")] public override Task Can_apply_all_migrations_async() => base.Can_apply_all_migrations_async(); diff --git a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs index bff25bffe0..aad9d000a8 100644 --- a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs @@ -1,4 +1,4 @@ -using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure; +using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.Internal; using Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal; @@ -3246,7 +3246,7 @@ public override async Task Add_required_primitive_collection_with_custom_default AssertSql("""ALTER TABLE "Customers" ADD "Numbers" integer[] NOT NULL DEFAULT (ARRAY[1,2,3]);"""); } - [ConditionalFact(Skip = "issue #33038")] + [ActiveIssue("issue #33038")] public override async Task Add_required_primitive_collection_with_custom_converter_to_existing_table() { await base.Add_required_primitive_collection_with_custom_converter_to_existing_table(); @@ -3337,7 +3337,7 @@ public override async Task Add_required_primitve_collection_with_custom_default_ AssertSql("""ALTER TABLE "Customers" ADD "Numbers" integer[] NOT NULL DEFAULT ARRAY[1,2,3]::integer[];"""); } - [ConditionalFact(Skip = "issue #33038")] + [ActiveIssue("issue #33038")] public override async Task Add_required_primitve_collection_with_custom_converter_to_existing_table() { await base.Add_required_primitve_collection_with_custom_converter_to_existing_table(); diff --git a/test/EFCore.PG.FunctionalTests/Query/AdHocMiscellaneousQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/AdHocMiscellaneousQueryNpgsqlTest.cs index 9067340a93..e94488ab5c 100644 --- a/test/EFCore.PG.FunctionalTests/Query/AdHocMiscellaneousQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/AdHocMiscellaneousQueryNpgsqlTest.cs @@ -33,7 +33,7 @@ public override Task SelectMany_where_Select(bool async) public override Task Subquery_first_member_compared_to_null(bool async) => Task.CompletedTask; - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/pull/27995/files#r874038747")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/27995/files#r874038747")] public override Task StoreType_for_UDF_used(bool async) => base.StoreType_for_UDF_used(async); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs index 8bb50f0817..5b3acf76f2 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs @@ -177,7 +177,6 @@ public override async Task Index_out_of_bounds() #region GroupBy - [ConditionalFact] public override async Task GroupBy() { await base.GroupBy(); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs index 75f696e390..0469b4e45c 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs @@ -210,7 +210,6 @@ public override async Task Index_out_of_bounds() #region GroupBy - [ConditionalFact] public override async Task GroupBy() { await base.GroupBy(); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs index 855fdbb008..649da461f7 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs @@ -191,7 +191,6 @@ public override async Task Index_out_of_bounds() #region GroupBy - [ConditionalFact] public override async Task GroupBy() { await base.GroupBy(); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs index 0d768c9456..1c0859e643 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs @@ -213,7 +213,6 @@ public override async Task Index_out_of_bounds() #region GroupBy - [ConditionalFact] public override async Task GroupBy() { await base.GroupBy(); diff --git a/test/EFCore.PG.FunctionalTests/Query/CompatibilityQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/CompatibilityQueryNpgsqlTest.cs index dbe9435730..7792d0c122 100644 --- a/test/EFCore.PG.FunctionalTests/Query/CompatibilityQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/CompatibilityQueryNpgsqlTest.cs @@ -74,7 +74,7 @@ public virtual CompatibilityContext CreateRedshiftContext() return new CompatibilityContext(builder.Options); } - public virtual async Task InitializeAsync() + public virtual async ValueTask InitializeAsync() { _testStore = NpgsqlTestStoreFactory.Instance.GetOrCreate(StoreName); await _testStore.InitializeAsync(null, CreateContext, c => CompatibilityContext.SeedAsync((CompatibilityContext)c)); @@ -85,7 +85,7 @@ public virtual void Dispose() { } - public virtual async Task DisposeAsync() + public virtual async ValueTask DisposeAsync() => await _testStore.DisposeAsync(); } diff --git a/test/EFCore.PG.FunctionalTests/Query/ComplexNavigationsSharedTypeQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/ComplexNavigationsSharedTypeQueryNpgsqlTest.cs index fc8c7346a2..d657a436d3 100644 --- a/test/EFCore.PG.FunctionalTests/Query/ComplexNavigationsSharedTypeQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/ComplexNavigationsSharedTypeQueryNpgsqlTest.cs @@ -15,7 +15,7 @@ public ComplexNavigationsSharedTypeQueryNpgsqlTest( Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/issues/26353")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/26353")] public override Task Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(bool async) => base.Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(async); @@ -30,11 +30,11 @@ public override Task GroupJoin_client_method_in_OrderBy(bool async) "Microsoft.EntityFrameworkCore.Query.ComplexNavigationsQueryTestBase", "ClientMethodNullableInt")); - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/issues/26104")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/26104")] public override Task GroupBy_aggregate_where_required_relationship(bool async) => base.GroupBy_aggregate_where_required_relationship(async); - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/issues/26104")] + [ActiveIssue("https://github.com/dotnet/efcore/issues/26104")] public override Task GroupBy_aggregate_where_required_relationship_2(bool async) => base.GroupBy_aggregate_where_required_relationship_2(async); } diff --git a/test/EFCore.PG.FunctionalTests/Query/EntitySplittingQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/EntitySplittingQueryNpgsqlTest.cs index f9ff56eb76..5f0715a2d7 100644 --- a/test/EFCore.PG.FunctionalTests/Query/EntitySplittingQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/EntitySplittingQueryNpgsqlTest.cs @@ -224,7 +224,7 @@ END AS "OwnedStringValue4" """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Normal_entity_owning_a_split_reference_with_main_fragment_not_sharing(bool async) { await base.Normal_entity_owning_a_split_reference_with_main_fragment_not_sharing(async); @@ -232,7 +232,7 @@ public override async Task Normal_entity_owning_a_split_reference_with_main_frag AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Normal_entity_owning_a_split_reference_with_main_fragment_not_sharing_custom_projection(bool async) { await base.Normal_entity_owning_a_split_reference_with_main_fragment_not_sharing_custom_projection(async); @@ -240,7 +240,7 @@ public override async Task Normal_entity_owning_a_split_reference_with_main_frag AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Normal_entity_owning_a_split_collection(bool async) { await base.Normal_entity_owning_a_split_collection(async); @@ -291,7 +291,7 @@ public override async Task Split_entity_owning_a_collection(bool async) """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Split_entity_owning_a_split_reference_without_table_sharing(bool async) { await base.Split_entity_owning_a_split_reference_without_table_sharing(async); @@ -299,7 +299,7 @@ public override async Task Split_entity_owning_a_split_reference_without_table_s AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Split_entity_owning_a_split_collection(bool async) { await base.Split_entity_owning_a_split_collection(async); @@ -334,7 +334,7 @@ public override async Task Split_entity_owning_a_split_reference_with_table_shar """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Split_entity_owning_a_split_reference_with_table_sharing_6(bool async) { await base.Split_entity_owning_a_split_reference_with_table_sharing_6(async); @@ -562,7 +562,7 @@ public override async Task Tpc_entity_owning_a_split_reference_on_leaf_with_tabl """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tph_entity_owning_a_split_reference_on_base_without_table_sharing(bool async) { await base.Tph_entity_owning_a_split_reference_on_base_without_table_sharing(async); @@ -570,7 +570,7 @@ public override async Task Tph_entity_owning_a_split_reference_on_base_without_t AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpt_entity_owning_a_split_reference_on_base_without_table_sharing(bool async) { await base.Tpt_entity_owning_a_split_reference_on_base_without_table_sharing(async); @@ -604,7 +604,7 @@ UNION ALL """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tph_entity_owning_a_split_reference_on_middle_without_table_sharing(bool async) { await base.Tph_entity_owning_a_split_reference_on_middle_without_table_sharing(async); @@ -612,7 +612,7 @@ public override async Task Tph_entity_owning_a_split_reference_on_middle_without AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpt_entity_owning_a_split_reference_on_middle_without_table_sharing(bool async) { await base.Tpt_entity_owning_a_split_reference_on_middle_without_table_sharing(async); @@ -646,7 +646,7 @@ UNION ALL """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tph_entity_owning_a_split_reference_on_leaf_without_table_sharing(bool async) { await base.Tph_entity_owning_a_split_reference_on_leaf_without_table_sharing(async); @@ -654,7 +654,7 @@ public override async Task Tph_entity_owning_a_split_reference_on_leaf_without_t AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpt_entity_owning_a_split_reference_on_leaf_without_table_sharing(bool async) { await base.Tpt_entity_owning_a_split_reference_on_leaf_without_table_sharing(async); @@ -662,7 +662,7 @@ public override async Task Tpt_entity_owning_a_split_reference_on_leaf_without_t AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpc_entity_owning_a_split_reference_on_leaf_without_table_sharing(bool async) { await base.Tpc_entity_owning_a_split_reference_on_leaf_without_table_sharing(async); @@ -670,7 +670,7 @@ public override async Task Tpc_entity_owning_a_split_reference_on_leaf_without_t AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tph_entity_owning_a_split_collection_on_base(bool async) { await base.Tph_entity_owning_a_split_collection_on_base(async); @@ -678,7 +678,7 @@ public override async Task Tph_entity_owning_a_split_collection_on_base(bool asy AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpt_entity_owning_a_split_collection_on_base(bool async) { await base.Tpt_entity_owning_a_split_collection_on_base(async); @@ -716,7 +716,7 @@ LEFT JOIN ( """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tph_entity_owning_a_split_collection_on_middle(bool async) { await base.Tph_entity_owning_a_split_collection_on_middle(async); @@ -724,7 +724,7 @@ public override async Task Tph_entity_owning_a_split_collection_on_middle(bool a AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpt_entity_owning_a_split_collection_on_middle(bool async) { await base.Tpt_entity_owning_a_split_collection_on_middle(async); @@ -762,7 +762,7 @@ LEFT JOIN ( """); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tph_entity_owning_a_split_collection_on_leaf(bool async) { await base.Tph_entity_owning_a_split_collection_on_leaf(async); @@ -770,7 +770,7 @@ public override async Task Tph_entity_owning_a_split_collection_on_leaf(bool asy AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpt_entity_owning_a_split_collection_on_leaf(bool async) { await base.Tpt_entity_owning_a_split_collection_on_leaf(async); @@ -778,7 +778,7 @@ public override async Task Tpt_entity_owning_a_split_collection_on_leaf(bool asy AssertSql(); } - [ConditionalTheory(Skip = "Issue29075")] + [ActiveIssue("Issue29075")] public override async Task Tpc_entity_owning_a_split_collection_on_leaf(bool async) { await base.Tpc_entity_owning_a_split_collection_on_leaf(async); diff --git a/test/EFCore.PG.FunctionalTests/Query/FromSqlQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/FromSqlQueryNpgsqlTest.cs index d990d5d029..ffea659b78 100644 --- a/test/EFCore.PG.FunctionalTests/Query/FromSqlQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/FromSqlQueryNpgsqlTest.cs @@ -1,4 +1,4 @@ -using System.Data.Common; +using System.Data.Common; using Microsoft.EntityFrameworkCore.TestModels.Northwind; using Xunit.Sdk; @@ -7,11 +7,11 @@ namespace Microsoft.EntityFrameworkCore.Query; public class FromSqlQueryNpgsqlTest(NorthwindQueryNpgsqlFixture fixture) : FromSqlQueryTestBase>(fixture) { - [ConditionalTheory(Skip = "https://github.com/aspnet/EntityFramework/issues/{6563,20364}")] + [ActiveIssue("https://github.com/aspnet/EntityFramework/issues/{6563,20364}")] public override Task Bad_data_error_handling_invalid_cast(bool async) => base.Bad_data_error_handling_invalid_cast(async); - [ConditionalTheory(Skip = "https://github.com/aspnet/EntityFramework/issues/{6563,20364}")] + [ActiveIssue("https://github.com/aspnet/EntityFramework/issues/{6563,20364}")] public override Task Bad_data_error_handling_invalid_cast_projection(bool async) => base.Bad_data_error_handling_invalid_cast_projection(async); @@ -66,7 +66,6 @@ from o in context.Set().FromSql( Assert.Single(actual); } - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public override async Task FromSql_queryable_multiple_composed_with_parameters_and_closure_parameters_interpolated(bool async) { diff --git a/test/EFCore.PG.FunctionalTests/Query/Inheritance/TPCInheritanceQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Inheritance/TPCInheritanceQueryNpgsqlTest.cs index 427cd8c2a1..e124392713 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Inheritance/TPCInheritanceQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Inheritance/TPCInheritanceQueryNpgsqlTest.cs @@ -78,11 +78,8 @@ ORDER BY e1."Id" NULLS FIRST """); } - // Seed data for the fixture manually inserts entities with IDs 1, 2; then this test attempts to insert another one with an auto-generated ID, - // but the PG sequence wasn't updated so produces 1, resulting in a conflict. The test should be consistent in either using either - // auto-generated IDs or not across the board. public override Task Can_insert_update_delete() - => Assert.ThrowsAsync(base.Can_insert_update_delete); + => base.Can_insert_update_delete(); public override async Task Can_query_all_animals(bool async) { diff --git a/test/EFCore.PG.FunctionalTests/Query/LegacyTimestampQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/LegacyTimestampQueryTest.cs index 1f64419401..899fc618d7 100644 --- a/test/EFCore.PG.FunctionalTests/Query/LegacyTimestampQueryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/LegacyTimestampQueryTest.cs @@ -110,10 +110,10 @@ public LegacyTimestampQueryFixture() NpgsqlTypeMappingSource.LegacyTimestampBehavior = true; } - public override Task DisposeAsync() + public override ValueTask DisposeAsync() { NpgsqlTypeMappingSource.LegacyTimestampBehavior = false; - return Task.CompletedTask; + return ValueTask.CompletedTask; } protected override async Task SeedAsync(TimestampQueryContext context) diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs index 64df0f9ec1..71be547c88 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindDbFunctionsQueryNpgsqlTest.cs @@ -127,7 +127,7 @@ WHERE c."ContactName" NOT ILIKE '%M%' OR c."ContactName" IS NULL #region Collation [MinimumPostgresVersion(12, 0)] - [PlatformSkipCondition(TestUtilities.Xunit.TestPlatform.Windows, SkipReason = "ICU non-deterministic doesn't seem to work on Windows?")] + [SkipOnPlatform(TestPlatforms.Windows, "ICU non-deterministic doesn't seem to work on Windows?")] public override async Task Collate_case_insensitive(bool async) { await base.Collate_case_insensitive(async); diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs index 9d83ef072f..e38d340feb 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindGroupByQueryNpgsqlTest.cs @@ -2031,7 +2031,7 @@ ORDER BY o0."CustomerID" NULLS FIRST """); } - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/pull/28410")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/28410")] public override async Task Select_nested_collection_with_groupby(bool async) { await base.Select_nested_collection_with_groupby(async); diff --git a/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs index 4613bd4fa9..d95d6948b9 100644 --- a/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs @@ -2657,7 +2657,6 @@ WHERE NOT (p."Int" = ANY (@ints) AND p."Int" = ANY (@ints) IS NOT NULL) """); } - [ConditionalFact] public override async Task Multidimensional_array_is_not_supported() { // Multidimensional arrays are supported in PostgreSQL (via the regular array type); the EFCore.PG maps .NET diff --git a/test/EFCore.PG.FunctionalTests/Query/SqlQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/SqlQueryNpgsqlTest.cs index 06d397871b..3049646d06 100644 --- a/test/EFCore.PG.FunctionalTests/Query/SqlQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/SqlQueryNpgsqlTest.cs @@ -1,4 +1,4 @@ -using System.Data.Common; +using System.Data.Common; using Xunit.Sdk; namespace Microsoft.EntityFrameworkCore.Query; @@ -360,7 +360,7 @@ SELECT m."ProductName" """); } - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/pull/30384")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/30384")] public override async Task SqlQueryRaw_annotations_do_not_affect_successive_calls(bool async) { await base.SqlQueryRaw_annotations_do_not_affect_successive_calls(async); @@ -460,7 +460,7 @@ public override async Task SqlQuery_with_inlined_db_parameter_without_name_prefi """); } - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/pull/30384")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/30384")] public override async Task SqlQuery_parameterization_issue_12213(bool async) { await base.SqlQuery_parameterization_issue_12213(async); @@ -672,11 +672,11 @@ WHERE m."ContactName" LIKE '%z%' } #pragma warning disable xUnit1026 - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/pull/30384")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/30384")] public override Task Bad_data_error_handling_invalid_cast(bool async) => Task.CompletedTask; - [ConditionalTheory(Skip = "https://github.com/dotnet/efcore/pull/30384")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/30384")] public override Task Bad_data_error_handling_invalid_cast_projection(bool async) => Task.CompletedTask; #pragma warning restore xUnit1026 diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs index 8ec0c43dd7..1dbd9c51c7 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs @@ -100,7 +100,6 @@ public override async Task SequenceEqual() """); } - [ConditionalFact] public override async Task Any() { await AssertQuery(ss => ss.Set().Where(e => e.ByteArray.Any())); diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs index cb0ec09527..a410dc72a4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs @@ -426,7 +426,12 @@ public override async Task Sign() """ SELECT b."Id", b."Bool", b."Byte", b."ByteArray", b."DateOnly", b."DateTime", b."DateTimeOffset", b."Decimal", b."Double", b."Enum", b."FlagsEnum", b."Float", b."Guid", b."Int", b."Long", b."Short", b."String", b."TimeOnly", b."TimeSpan" FROM "BasicTypesEntities" AS b -WHERE sign(b."Double") > 0 +WHERE sign(b."Double")::int > 0 +""", + // + """ +SELECT sign(b."Double")::int +FROM "BasicTypesEntities" AS b """); } @@ -438,7 +443,12 @@ public override async Task Sign_float() """ SELECT b."Id", b."Bool", b."Byte", b."ByteArray", b."DateOnly", b."DateTime", b."DateTimeOffset", b."Decimal", b."Double", b."Enum", b."FlagsEnum", b."Float", b."Guid", b."Int", b."Long", b."Short", b."String", b."TimeOnly", b."TimeSpan" FROM "BasicTypesEntities" AS b -WHERE sign(b."Float") > 0 +WHERE sign(b."Float")::int > 0 +""", + // + """ +SELECT sign(b."Float")::int +FROM "BasicTypesEntities" AS b """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs b/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs index 334ec25b9c..ec6051c86b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs +++ b/test/EFCore.PG.FunctionalTests/Query/UdfDbFunctionNpgsqlTests.cs @@ -1,4 +1,4 @@ -namespace Microsoft.EntityFrameworkCore.Query; +namespace Microsoft.EntityFrameworkCore.Query; #nullable disable @@ -584,7 +584,7 @@ LIMIT 2 #endregion #if RELEASE - [ConditionalFact(Skip = "https://github.com/dotnet/efcore/pull/30388")] + [ActiveIssue("https://github.com/dotnet/efcore/pull/30388")] public override void Scalar_Function_with_nullable_value_return_type_throws() {} #endif diff --git a/test/EFCore.PG.FunctionalTests/Scaffolding/NpgsqlDatabaseModelFactoryTest.cs b/test/EFCore.PG.FunctionalTests/Scaffolding/NpgsqlDatabaseModelFactoryTest.cs index 7cdfe3d885..faa5c1d666 100644 --- a/test/EFCore.PG.FunctionalTests/Scaffolding/NpgsqlDatabaseModelFactoryTest.cs +++ b/test/EFCore.PG.FunctionalTests/Scaffolding/NpgsqlDatabaseModelFactoryTest.cs @@ -2214,7 +2214,7 @@ protected override ITestStoreFactory TestStoreFactory public new NpgsqlTestStore TestStore => (NpgsqlTestStore)base.TestStore; - public override async Task InitializeAsync() + public override async ValueTask InitializeAsync() { await base.InitializeAsync(); await TestStore.ExecuteNonQueryAsync("CREATE SCHEMA IF NOT EXISTS db2"); diff --git a/test/EFCore.PG.FunctionalTests/SequenceEndToEndTest.cs b/test/EFCore.PG.FunctionalTests/SequenceEndToEndTest.cs index 7fea096121..918f1a655d 100644 --- a/test/EFCore.PG.FunctionalTests/SequenceEndToEndTest.cs +++ b/test/EFCore.PG.FunctionalTests/SequenceEndToEndTest.cs @@ -391,9 +391,9 @@ private class Unicon protected NpgsqlTestStore TestStore { get; private set; } = null!; - public async Task InitializeAsync() + public async ValueTask InitializeAsync() => TestStore = await NpgsqlTestStore.CreateInitializedAsync("SequenceEndToEndTest"); - public async Task DisposeAsync() + public async ValueTask DisposeAsync() => await TestStore.DisposeAsync(); } diff --git a/test/EFCore.PG.FunctionalTests/TestUtilities/MinimumPostgresVersionAttribute.cs b/test/EFCore.PG.FunctionalTests/TestUtilities/MinimumPostgresVersionAttribute.cs index 134331d743..ab2c93e49a 100644 --- a/test/EFCore.PG.FunctionalTests/TestUtilities/MinimumPostgresVersionAttribute.cs +++ b/test/EFCore.PG.FunctionalTests/TestUtilities/MinimumPostgresVersionAttribute.cs @@ -1,13 +1,16 @@ namespace Microsoft.EntityFrameworkCore.TestUtilities; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] -public sealed class MinimumPostgresVersionAttribute(int major, int minor) : Attribute, ITestCondition +public sealed class MinimumPostgresVersionAttribute(int major, int minor) : Attribute, global::Xunit.v3.ITraitAttribute { private readonly Version _version = new(major, minor); - public ValueTask IsMetAsync() - => new(TestEnvironment.PostgresVersion >= _version); + private bool IsMet + => TestEnvironment.PostgresVersion >= _version; public string SkipReason => $"Requires PostgreSQL version {_version} or later."; + + public IReadOnlyCollection> GetTraits() + => IsMet ? [] : [new("category", "failing")]; } diff --git a/test/EFCore.PG.FunctionalTests/TestUtilities/RequiresPostgisAttribute.cs b/test/EFCore.PG.FunctionalTests/TestUtilities/RequiresPostgisAttribute.cs index 17266f9b05..73884a712b 100644 --- a/test/EFCore.PG.FunctionalTests/TestUtilities/RequiresPostgisAttribute.cs +++ b/test/EFCore.PG.FunctionalTests/TestUtilities/RequiresPostgisAttribute.cs @@ -3,11 +3,15 @@ namespace Microsoft.EntityFrameworkCore.TestUtilities; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] -public sealed class RequiresPostgisAttribute : Attribute, ITestCondition +public sealed class RequiresPostgisAttribute : Attribute, global::Xunit.v3.ITraitAttribute { - public ValueTask IsMetAsync() - => new(TestEnvironment.IsPostgisAvailable || Environment.GetEnvironmentVariable("NPGSQL_TEST_POSTGIS")?.ToLower(CultureInfo.InvariantCulture) is "1" or "true"); + private static bool IsMet + => TestEnvironment.IsPostgisAvailable + || Environment.GetEnvironmentVariable("NPGSQL_TEST_POSTGIS")?.ToLower(CultureInfo.InvariantCulture) is "1" or "true"; public string SkipReason => "PostGIS isn't installed, skipping"; + + public IReadOnlyCollection> GetTraits() + => IsMet ? [] : [new("category", "failing")]; } diff --git a/test/EFCore.PG.FunctionalTests/TestUtilities/TestEnvironment.cs b/test/EFCore.PG.FunctionalTests/TestUtilities/TestEnvironment.cs index 47ec455bea..7ebd08f6dd 100644 --- a/test/EFCore.PG.FunctionalTests/TestUtilities/TestEnvironment.cs +++ b/test/EFCore.PG.FunctionalTests/TestUtilities/TestEnvironment.cs @@ -53,7 +53,8 @@ static TestEnvironment() }; } - Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); + CultureInfo.DefaultThreadCurrentCulture = Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); + CultureInfo.DefaultThreadCurrentUICulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); } private static Version? _postgresVersion; diff --git a/test/EFCore.PG.FunctionalTests/Update/JsonUpdateNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Update/JsonUpdateNpgsqlTest.cs index eeb8abaa76..053aef053d 100644 --- a/test/EFCore.PG.FunctionalTests/Update/JsonUpdateNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Update/JsonUpdateNpgsqlTest.cs @@ -1255,7 +1255,6 @@ LIMIT 2 """); } - [ConditionalFact] public override async Task Edit_single_property_with_converter_string_True_False_to_bool() { await base.Edit_single_property_with_converter_string_True_False_to_bool(); @@ -1277,7 +1276,6 @@ LIMIT 2 """); } - [ConditionalFact] public override async Task Edit_single_property_with_converter_string_Y_N_to_bool() { await base.Edit_single_property_with_converter_string_Y_N_to_bool(); diff --git a/test/EFCore.PG.FunctionalTests/ValueConvertersEndToEndNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/ValueConvertersEndToEndNpgsqlTest.cs index 7fa28f4e15..82128cbdd5 100644 --- a/test/EFCore.PG.FunctionalTests/ValueConvertersEndToEndNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/ValueConvertersEndToEndNpgsqlTest.cs @@ -3,7 +3,7 @@ namespace Microsoft.EntityFrameworkCore; public class ValueConvertersEndToEndNpgsqlTest(ValueConvertersEndToEndNpgsqlTest.ValueConvertersEndToEndNpgsqlFixture fixture) : ValueConvertersEndToEndTestBase(fixture) { - [ConditionalTheory(Skip = "DateTime and DateTimeOffset, https://github.com/dotnet/efcore/issues/26068")] + [ActiveIssue("DateTime and DateTimeOffset, https://github.com/dotnet/efcore/issues/26068")] public override Task Can_insert_and_read_back_with_conversions(int[] valueOrder) => base.Can_insert_and_read_back_with_conversions(valueOrder);