Skip to content

Commit c5fe9d4

Browse files
Copilotrenemadsen
andcommitted
Fix EntitySplittingMySqlTest constructor and EFCoreCompatibilityTests ambiguity for EF Core 10
Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent d6e20eb commit c5fe9d4

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

test/EFCore.MySql.FunctionalTests/EFCoreCompatibilityTests.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.EntityFrameworkCore;
88
using Pomelo.EntityFrameworkCore.MySql.Infrastructure.Internal;
99
using Xunit;
10+
using CompatHelper = Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.EFCoreCompatibilityHelper;
1011

1112
namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests
1213
{
@@ -27,7 +28,7 @@ public EFCoreCompatibilityTests(CompatibilityTestFixture fixture)
2728
public void EFCoreVersion_IsDetected()
2829
{
2930
// Verify that version detection works
30-
var version = EFCoreCompatibilityHelper.EFCoreVersion;
31+
var version = CompatHelper.EFCoreVersion;
3132
Assert.NotNull(version);
3233
Assert.True(version.Major >= 8, "Should be using EF Core 8 or greater");
3334
}
@@ -36,19 +37,19 @@ public void EFCoreVersion_IsDetected()
3637
public void VersionFlags_AreSetCorrectly()
3738
{
3839
// Test version detection flags
39-
var isEFCore8OrGreater = EFCoreCompatibilityHelper.IsEFCore8OrGreater;
40-
var isEFCore9OrGreater = EFCoreCompatibilityHelper.IsEFCore9OrGreater;
41-
var isEFCore10OrGreater = EFCoreCompatibilityHelper.IsEFCore10OrGreater;
40+
var isEFCore8OrGreater = CompatHelper.IsEFCore8OrGreater;
41+
var isEFCore9OrGreater = CompatHelper.IsEFCore9OrGreater;
42+
var isEFCore10OrGreater = CompatHelper.IsEFCore10OrGreater;
4243

4344
Assert.True(isEFCore8OrGreater, "Should support EF Core 8+");
4445

4546
// These will be true based on the actual EF Core version being used
46-
if (EFCoreCompatibilityHelper.EFCoreVersion.Major >= 9)
47+
if (CompatHelper.EFCoreVersion.Major >= 9)
4748
{
4849
Assert.True(isEFCore9OrGreater);
4950
}
5051

51-
if (EFCoreCompatibilityHelper.EFCoreVersion.Major >= 10)
52+
if (CompatHelper.EFCoreVersion.Major >= 10)
5253
{
5354
Assert.True(isEFCore10OrGreater);
5455
}
@@ -138,19 +139,19 @@ await context.TestEntities
138139
public void CreateExecuteUpdateSetter_ReturnsCorrectType()
139140
{
140141
// Test the compatibility helper method
141-
if (EFCoreCompatibilityHelper.IsEFCore10OrGreater)
142+
if (CompatHelper.IsEFCore10OrGreater)
142143
{
143144
// For EF Core 10+, should return Action<T>
144145
Action<TestEntity> action = e => e.Name = "test";
145-
var result = EFCoreCompatibilityHelper.CreateExecuteUpdateSetter<TestEntity>(setterAction: action);
146+
var result = CompatHelper.CreateExecuteUpdateSetter<TestEntity>(setterAction: action);
146147
Assert.IsType<Action<TestEntity>>(result);
147148
}
148149
else
149150
{
150151
// For EF Core 9-, should return Expression<Func<T, T>>
151152
System.Linq.Expressions.Expression<Func<TestEntity, TestEntity>> expression =
152153
e => new TestEntity { Name = "test" };
153-
var result = EFCoreCompatibilityHelper.CreateExecuteUpdateSetter<TestEntity>(setterExpression: expression);
154+
var result = CompatHelper.CreateExecuteUpdateSetter<TestEntity>(setterExpression: expression);
154155
Assert.IsType<System.Linq.Expressions.Expression<Func<TestEntity, TestEntity>>>(result);
155156
}
156157
}

test/EFCore.MySql.FunctionalTests/EntitySplittingMySqlTest.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66
namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests;
77

8-
public class EntitySplittingMySqlTest : EntitySplittingTestBase
8+
public class EntitySplittingMySqlTest : EntitySplittingTestBase<EntitySplittingMySqlTest.EntitySplittingMySqlFixture>
99
{
10-
public EntitySplittingMySqlTest(ITestOutputHelper testOutputHelper)
11-
: base(testOutputHelper)
10+
public EntitySplittingMySqlTest(EntitySplittingMySqlFixture fixture, ITestOutputHelper testOutputHelper)
11+
: base(fixture, testOutputHelper)
1212
{
1313
}
1414

15-
protected override ITestStoreFactory TestStoreFactory
16-
=> MySqlTestStoreFactory.Instance;
15+
public class EntitySplittingMySqlFixture : EntitySplittingFixtureBase
16+
{
17+
protected override ITestStoreFactory TestStoreFactory
18+
=> MySqlTestStoreFactory.Instance;
19+
}
1720
}

0 commit comments

Comments
 (0)