Skip to content

Commit 02b5a95

Browse files
CopilotCopilot
andcommitted
Change fixture classes from SharedStoreFixtureBase<T>, IQueryFixtureBase to QueryFixtureBase<T>
Update TimestampQueryFixture, NodaTimeQueryNpgsqlFixture, BigIntegerQueryFixture, and EnumFixture to inherit from QueryFixtureBase<T> instead of SharedStoreFixtureBase<T> with IQueryFixtureBase. Remove GetContextCreator() (provided by base class) and change GetExpectedData(), EntitySorters, and EntityAsserters to override. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 47c04be commit 02b5a95

4 files changed

Lines changed: 16 additions & 28 deletions

File tree

test/EFCore.PG.FunctionalTests/Query/Translations/BigIntegerTranslationsTest.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public class Entity
144144
public BigInteger BigInteger { get; set; }
145145
}
146146

147-
public class BigIntegerQueryFixture : SharedStoreFixtureBase<BigIntegerQueryContext>, IQueryFixtureBase, ITestSqlLoggerFactory
147+
public class BigIntegerQueryFixture : QueryFixtureBase<BigIntegerQueryContext>, ITestSqlLoggerFactory
148148
{
149149
private BigIntegerData? _expectedData;
150150

@@ -160,17 +160,14 @@ public TestSqlLoggerFactory TestSqlLoggerFactory
160160
protected override Task SeedAsync(BigIntegerQueryContext context)
161161
=> BigIntegerQueryContext.SeedAsync(context);
162162

163-
public Func<DbContext> GetContextCreator()
164-
=> CreateContext;
165-
166-
public ISetSource GetExpectedData()
163+
public override ISetSource GetExpectedData()
167164
=> _expectedData ??= new BigIntegerData();
168165

169-
public IReadOnlyDictionary<Type, object> EntitySorters
166+
public override IReadOnlyDictionary<Type, object> EntitySorters
170167
=> new Dictionary<Type, Func<object, object?>> { { typeof(Entity), e => ((Entity)e).Id } }
171168
.ToDictionary(e => e.Key, e => (object)e.Value);
172169

173-
public IReadOnlyDictionary<Type, object> EntityAsserters
170+
public override IReadOnlyDictionary<Type, object> EntityAsserters
174171
=> new Dictionary<Type, Action<object, object>>
175172
{
176173
{

test/EFCore.PG.FunctionalTests/Query/Translations/EnumTranslationsTest.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public enum UnmappedByteEnum : byte
310310
}
311311

312312
// ReSharper disable once ClassNeverInstantiated.Global
313-
public class EnumFixture : SharedStoreFixtureBase<EnumContext>, IQueryFixtureBase, ITestSqlLoggerFactory
313+
public class EnumFixture : QueryFixtureBase<EnumContext>, ITestSqlLoggerFactory
314314
{
315315
protected override string StoreName
316316
=> "EnumQueryTest";
@@ -342,17 +342,14 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build
342342
protected override Task SeedAsync(EnumContext context)
343343
=> EnumContext.SeedAsync(context);
344344

345-
public Func<DbContext> GetContextCreator()
346-
=> CreateContext;
347-
348-
public ISetSource GetExpectedData()
345+
public override ISetSource GetExpectedData()
349346
=> _expectedData ??= new EnumData();
350347

351-
public IReadOnlyDictionary<Type, object> EntitySorters
348+
public override IReadOnlyDictionary<Type, object> EntitySorters
352349
=> new Dictionary<Type, Func<object, object?>> { { typeof(SomeEnumEntity), e => ((SomeEnumEntity)e)?.Id } }
353350
.ToDictionary(e => e.Key, e => (object)e.Value);
354351

355-
public IReadOnlyDictionary<Type, object> EntityAsserters
352+
public override IReadOnlyDictionary<Type, object> EntityAsserters
356353
=> new Dictionary<Type, Action<object, object>>
357354
{
358355
{

test/EFCore.PG.FunctionalTests/Query/Translations/NodaTime/NodaTimeQueryNpgsqlFixture.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Microsoft.EntityFrameworkCore.Query.Translations.NodaTime;
66

7-
public class NodaTimeQueryNpgsqlFixture : SharedStoreFixtureBase<NodaTimeContext>, IQueryFixtureBase, ITestSqlLoggerFactory
7+
public class NodaTimeQueryNpgsqlFixture : QueryFixtureBase<NodaTimeContext>, ITestSqlLoggerFactory
88
{
99
protected override string StoreName
1010
=> "NodaTimeQueryTest";
@@ -36,17 +36,14 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build
3636
protected override Task SeedAsync(NodaTimeContext context)
3737
=> NodaTimeContext.SeedAsync(context);
3838

39-
public Func<DbContext> GetContextCreator()
40-
=> CreateContext;
41-
42-
public ISetSource GetExpectedData()
39+
public override ISetSource GetExpectedData()
4340
=> _expectedData ??= new NodaTimeData();
4441

45-
public IReadOnlyDictionary<Type, object> EntitySorters
42+
public override IReadOnlyDictionary<Type, object> EntitySorters
4643
=> new Dictionary<Type, Func<object, object?>> { { typeof(NodaTimeTypes), e => ((NodaTimeTypes)e).Id } }
4744
.ToDictionary(e => e.Key, e => (object)e.Value);
4845

49-
public IReadOnlyDictionary<Type, object> EntityAsserters
46+
public override IReadOnlyDictionary<Type, object> EntityAsserters
5047
=> new Dictionary<Type, Action<object, object>>
5148
{
5249
{

test/EFCore.PG.FunctionalTests/Query/Translations/TimestampTranslationsTest.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ public class Entity
909909
public NpgsqlRange<DateTime> TimestampDateTimeRange { get; set; }
910910
}
911911

912-
public class TimestampQueryFixture : SharedStoreFixtureBase<TimestampQueryContext>, IQueryFixtureBase, ITestSqlLoggerFactory
912+
public class TimestampQueryFixture : QueryFixtureBase<TimestampQueryContext>, ITestSqlLoggerFactory
913913
{
914914
protected override string StoreName
915915
=> "TimestampQueryTest";
@@ -928,17 +928,14 @@ public TestSqlLoggerFactory TestSqlLoggerFactory
928928
protected override Task SeedAsync(TimestampQueryContext context)
929929
=> TimestampQueryContext.SeedAsync(context);
930930

931-
public Func<DbContext> GetContextCreator()
932-
=> CreateContext;
933-
934-
public ISetSource GetExpectedData()
931+
public override ISetSource GetExpectedData()
935932
=> _expectedData ??= new TimestampData();
936933

937-
public IReadOnlyDictionary<Type, object> EntitySorters
934+
public override IReadOnlyDictionary<Type, object> EntitySorters
938935
=> new Dictionary<Type, Func<object, object?>> { { typeof(Entity), e => ((Entity)e)?.Id } }
939936
.ToDictionary(e => e.Key, e => (object)e.Value);
940937

941-
public IReadOnlyDictionary<Type, object> EntityAsserters
938+
public override IReadOnlyDictionary<Type, object> EntityAsserters
942939
=> new Dictionary<Type, Action<object, object>>
943940
{
944941
{

0 commit comments

Comments
 (0)