Skip to content

Commit e6534b2

Browse files
Shay RojanskyCopilot
andcommitted
Fix EF sync test fallout
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e19a516 commit e6534b2

28 files changed

Lines changed: 75 additions & 80 deletions

src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class NpgsqlMathTranslator(
1818
IModel model) : IMethodCallTranslator
1919
{
2020
private readonly RelationalTypeMapping _intTypeMapping = typeMappingSource.FindMapping(typeof(int), model)!;
21+
private readonly RelationalTypeMapping _doubleTypeMapping = typeMappingSource.FindMapping(typeof(double), model)!;
2122
private readonly RelationalTypeMapping _decimalTypeMapping = typeMappingSource.FindMapping(typeof(decimal), model)!;
2223

2324
/// <inheritdoc />
@@ -226,7 +227,8 @@ SqlExpression TranslateSign(SqlExpression argument)
226227
[argument],
227228
nullable: true,
228229
argumentsPropagateNullability: TrueArrays[1],
229-
method.ReturnType),
230+
argument.Type == typeof(decimal) ? typeof(decimal) : typeof(double),
231+
argument.Type == typeof(decimal) ? argument.TypeMapping : _doubleTypeMapping),
230232
typeof(int),
231233
_intTypeMapping);
232234
}

test/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
99

1010
<!-- There's lots of use of internal EF Core APIs from the tests, suppress the analyzer warnings for those -->
11-
<NoWarn>$(NoWarn);CS0618;xUnit1003;xUnit1004;xUnit1013;xUnit1024;xUnit1051;EF1001</NoWarn>
11+
<NoWarn>$(NoWarn);CS0618;xUnit1003;xUnit1004;xUnit1008;xUnit1013;xUnit1024;xUnit1051;EF1001</NoWarn>
1212
</PropertyGroup>
1313

1414
<PropertyGroup>

test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Immutable;
1+
using System.Collections.Immutable;
22
using System.ComponentModel.DataAnnotations.Schema;
33
using System.Net.NetworkInformation;
44

@@ -719,7 +719,7 @@ private static void AssertNullMappedNullableDataTypes(MappedNullableDataTypes en
719719
Assert.Null(entity.Mood);
720720
}
721721

722-
[ConditionalFact(Skip = "DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")]
722+
[ActiveIssue("DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")]
723723
public override Task Can_insert_and_read_back_object_backed_data_types()
724724
=> Task.CompletedTask;
725725

test/EFCore.PG.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesNpgsqlTest.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,6 @@ WHERE c."CustomerID" LIKE 'F%'
14071407
""");
14081408
}
14091409

1410-
[ConditionalTheory]
14111410
public override async Task Update_with_cross_join_left_join_set_constant(bool async)
14121411
{
14131412
await base.Update_with_cross_join_left_join_set_constant(async);
@@ -1437,7 +1436,6 @@ WHERE c."CustomerID" LIKE 'F%'
14371436
""");
14381437
}
14391438

1440-
[ConditionalTheory]
14411439
public override async Task Update_with_cross_join_cross_apply_set_constant(bool async)
14421440
{
14431441
await base.Update_with_cross_join_cross_apply_set_constant(async);
@@ -1467,7 +1465,6 @@ WHERE c."CustomerID" LIKE 'F%'
14671465
""");
14681466
}
14691467

1470-
[ConditionalTheory]
14711468
public override async Task Update_with_cross_join_outer_apply_set_constant(bool async)
14721469
{
14731470
await base.Update_with_cross_join_outer_apply_set_constant(async);
@@ -1577,7 +1574,6 @@ WHERE c."CustomerID" LIKE 'F%'
15771574
""");
15781575
}
15791576

1580-
[ConditionalTheory]
15811577
[MemberData(nameof(IsAsyncData))]
15821578
public override async Task Update_with_two_inner_joins(bool async)
15831579
{

test/EFCore.PG.FunctionalTests/ConnectionInterceptionNpgsqlTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ namespace Microsoft.EntityFrameworkCore;
77
public abstract class ConnectionInterceptionNpgsqlTestBase(ConnectionInterceptionNpgsqlTestBase.InterceptionNpgsqlFixtureBase fixture)
88
: ConnectionInterceptionTestBase(fixture)
99
{
10-
[ConditionalTheory(Skip = "#2368")]
10+
[ActiveIssue("#2368")]
1111
public override Task Intercept_connection_creation_passively(bool async)
1212
=> base.Intercept_connection_creation_passively(async);
1313

14-
[ConditionalTheory(Skip = "#2368")]
14+
[ActiveIssue("#2368")]
1515
public override Task Intercept_connection_creation_with_multiple_interceptors(bool async)
1616
=> base.Intercept_connection_creation_with_multiple_interceptors(async);
1717

18-
[ConditionalTheory(Skip = "#2368")]
18+
[ActiveIssue("#2368")]
1919
public override Task Intercept_connection_to_override_connection_after_creation(bool async)
2020
=> base.Intercept_connection_to_override_connection_after_creation(async);
2121

22-
[ConditionalTheory(Skip = "#2368")]
22+
[ActiveIssue("#2368")]
2323
public override Task Intercept_connection_to_override_creation(bool async)
2424
=> base.Intercept_connection_to_override_creation(async);
2525

test/EFCore.PG.FunctionalTests/ConvertToProviderTypesNpgsqlTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Microsoft.EntityFrameworkCore;
1+
namespace Microsoft.EntityFrameworkCore;
22

33
public class ConvertToProviderTypesNpgsqlTest : ConvertToProviderTypesTestBase<
44
ConvertToProviderTypesNpgsqlTest.ConvertToProviderTypesNpgsqlFixture>
@@ -49,7 +49,7 @@ public ConvertToProviderTypesNpgsqlTest(ConvertToProviderTypesNpgsqlFixture fixt
4949
// }
5050
// }
5151

52-
[ConditionalFact(Skip = "DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")]
52+
[ActiveIssue("DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")]
5353
public override Task Can_insert_and_read_back_object_backed_data_types()
5454
=> Task.CompletedTask;
5555

test/EFCore.PG.FunctionalTests/CustomConvertersNpgsqlTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Microsoft.EntityFrameworkCore;
1+
namespace Microsoft.EntityFrameworkCore;
22

33
public class CustomConvertersNpgsqlTest(CustomConvertersNpgsqlTest.CustomConvertersNpgsqlFixture fixture)
44
: CustomConvertersTestBase<CustomConvertersNpgsqlTest.CustomConvertersNpgsqlFixture>(fixture)
@@ -7,7 +7,7 @@ public class CustomConvertersNpgsqlTest(CustomConvertersNpgsqlTest.CustomConvert
77
public override Task Can_insert_and_read_back_with_case_insensitive_string_key()
88
=> Task.CompletedTask;
99

10-
[ConditionalFact(Skip = "DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")]
10+
[ActiveIssue("DateTimeOffset with non-zero offset, https://github.com/dotnet/efcore/issues/26068")]
1111
public override Task Can_insert_and_read_back_object_backed_data_types()
1212
=> Task.CompletedTask;
1313

test/EFCore.PG.FunctionalTests/JsonTypesNpgsqlTest.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ protected class NpgsqlDateOnlyCollectionType
210210
public List<DateOnly> DateOnly { get; set; } = null!;
211211
}
212212

213-
[ConditionalFact]
214213
public override Task Can_read_write_collection_of_nullable_DateOnly_JSON_values()
215214
=> Can_read_and_write_JSON_value<NullableDateOnlyCollectionType, List<DateOnly?>>(
216215
nameof(NullableDateOnlyCollectionType.DateOnly),
@@ -462,7 +461,6 @@ public virtual Task Can_read_write_LogSequenceNumber_JSON_values(ulong value, st
462461
new NpgsqlLogSequenceNumber(value),
463462
json);
464463

465-
[ConditionalFact]
466464
public override async Task Can_read_write_point()
467465
{
468466
var factory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326);
@@ -480,7 +478,6 @@ public virtual async Task Can_read_write_point_without_SRID()
480478
new Point(2, 4),
481479
"""{"Prop":"POINT (2 4)"}""");
482480

483-
[ConditionalFact]
484481
public override async Task Can_read_write_point_with_M()
485482
{
486483
var factory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326);
@@ -511,7 +508,6 @@ await Can_read_and_write_JSON_value<PointZMType, Point>(
511508
"""{"Prop":"SRID=4326;POINT Z(1 2 3)"}""");
512509
}
513510

514-
[ConditionalFact]
515511
public override async Task Can_read_write_line_string()
516512
{
517513
var factory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326);

test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Xunit.Sdk;
1+
using Xunit.Sdk;
22

33
namespace Microsoft.EntityFrameworkCore;
44

@@ -15,10 +15,9 @@ public LazyLoadProxyNpgsqlTest(LoadNpgsqlFixture fixture)
1515
public override void Can_serialize_proxies_to_JSON()
1616
=> Assert.Throws<EqualException>(base.Can_serialize_proxies_to_JSON);
1717

18-
[ConditionalFact] // Requires MARS
1918
public override void Top_level_projection_track_entities_before_passing_to_client_method() { }
2019

21-
[ConditionalTheory(Skip = "Possibly requires MARS, investigate")]
20+
[ActiveIssue("Possibly requires MARS, investigate")]
2221
public override void Lazy_load_one_to_one_reference_with_recursive_property(EntityState state)
2322
=> base.Lazy_load_one_to_one_reference_with_recursive_property(state);
2423

test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
1+
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
22
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
33

44
namespace Microsoft.EntityFrameworkCore.Migrations;
@@ -29,23 +29,23 @@ public override Task Can_apply_two_migrations_in_transaction_async()
2929
public override Task Can_generate_no_migration_script()
3030
=> base.Can_generate_no_migration_script();
3131

32-
[ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")]
32+
[ActiveIssue("https://github.com/dotnet/efcore/issues/33056")]
3333
public override void Can_apply_all_migrations()
3434
=> base.Can_apply_all_migrations();
3535

36-
[ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")]
36+
[ActiveIssue("https://github.com/dotnet/efcore/issues/33056")]
3737
public override void Can_apply_range_of_migrations()
3838
=> base.Can_apply_range_of_migrations();
3939

40-
[ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")]
40+
[ActiveIssue("https://github.com/dotnet/efcore/issues/33056")]
4141
public override void Can_revert_all_migrations()
4242
=> base.Can_revert_all_migrations();
4343

44-
[ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")]
44+
[ActiveIssue("https://github.com/dotnet/efcore/issues/33056")]
4545
public override void Can_revert_one_migrations()
4646
=> base.Can_revert_one_migrations();
4747

48-
[ConditionalFact(Skip = "https://github.com/dotnet/efcore/issues/33056")]
48+
[ActiveIssue("https://github.com/dotnet/efcore/issues/33056")]
4949
public override Task Can_apply_all_migrations_async()
5050
=> base.Can_apply_all_migrations_async();
5151

0 commit comments

Comments
 (0)