Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Microsoft.EntityFrameworkCore.BulkUpdates;

public class NonSharedModelBulkUpdatesNpgsqlTest(NonSharedFixture fixture) : NonSharedModelBulkUpdatesRelationalTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;


Expand Down Expand Up @@ -149,7 +149,7 @@ public override async Task Update_owned_and_non_owned_properties_with_table_shar
public override async Task Update_main_table_in_entity_with_entity_splitting(bool async)
{
// Overridden/duplicated because we update DateTime, which Npgsql requires to be a UTC timestamp
var contextFactory = await InitializeAsync<DbContext>(
var contextFactory = await InitializeNonSharedTest<DbContext>(
onModelCreating: mb => mb.Entity<Blog>()
.ToTable("Blogs")
.SplitToTable(
Expand All @@ -166,7 +166,7 @@ public override async Task Update_main_table_in_entity_with_entity_splitting(boo

await AssertUpdate(
async,
contextFactory.CreateContext,
contextFactory.CreateDbContext,
ss => ss.Set<Blog>(),
s => s.SetProperty(b => b.CreationTimestamp, b => new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc)),
rowsAffectedCount: 1);
Expand Down Expand Up @@ -226,7 +226,7 @@ SELECT COALESCE(sum(o0."Amount"), 0)::int
[MemberData(nameof(IsAsyncData))]
public virtual async Task Update_with_primitive_collection_in_value_selector(bool async)
{
var contextFactory = await InitializeAsync<Context3001>(
var contextFactory = await InitializeNonSharedTest<Context3001>(
seed: async ctx =>
{
ctx.AddRange(new EntityWithPrimitiveCollection { Tags = ["tag1", "tag2"] });
Expand All @@ -235,7 +235,7 @@ public virtual async Task Update_with_primitive_collection_in_value_selector(boo

await Assert.ThrowsAsync<InvalidOperationException>(() => AssertUpdate(
async,
contextFactory.CreateContext,
contextFactory.CreateDbContext,
ss => ss.EntitiesWithPrimitiveCollection,
s => s.SetProperty(x => x.Tags, x => x.Tags.Append("another_tag")),
rowsAffectedCount: 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace Microsoft.EntityFrameworkCore;
public class EntitySplittingNpgsqlTest(NonSharedFixture fixture, ITestOutputHelper testOutputHelper)
: EntitySplittingTestBase(fixture, testOutputHelper)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
2 changes: 1 addition & 1 deletion test/EFCore.PG.FunctionalTests/JsonTypesNpgsqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ protected class LogSequenceNumberType
public NpgsqlLogSequenceNumber LogSequenceNumber { get; set; }
}

protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance;
protected override ITestStoreFactory NonSharedTestStoreFactory => NpgsqlTestStoreFactory.Instance;

protected override IServiceCollection AddServices(IServiceCollection serviceCollection)
=> serviceCollection.AddEntityFrameworkNpgsqlNetTopologySuite();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
}
}

protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Microsoft.EntityFrameworkCore.Query;
public class AdHocAdvancedMappingsQueryNpgsqlTest(NonSharedFixture fixture)
: AdHocAdvancedMappingsQueryRelationalTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

// Cannot write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone', only UTC is supported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ LIMIT 2
""");
}

protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
10 changes: 5 additions & 5 deletions test/EFCore.PG.FunctionalTests/Query/AdHocJsonQueryNpgsqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Query;

public class AdHocJsonQueryNpgsqlTest(NonSharedFixture fixture) : AdHocJsonQueryRelationalTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

protected override async Task Seed29219(DbContext ctx)
Expand Down Expand Up @@ -179,7 +179,7 @@ protected override Task SeedBadJsonProperties(ContextBadJsonProperties ctx)
[ConditionalTheory, MemberData(nameof(IsAsyncData))]
public virtual async Task Json_predicate_on_bytea(bool async)
{
var contextFactory = await InitializeAsync<TypesDbContext>(
var contextFactory = await InitializeNonSharedTest<TypesDbContext>(
seed: async context =>
{
context.Entities.AddRange(
Expand All @@ -188,7 +188,7 @@ public virtual async Task Json_predicate_on_bytea(bool async)
await context.SaveChangesAsync();
});

using (var context = contextFactory.CreateContext())
using (var context = contextFactory.CreateDbContext())
{
var query = context.Entities.Where(x => x.JsonEntity.Bytea == new byte[] { 1, 2, 4 });

Expand All @@ -211,7 +211,7 @@ LIMIT 2
[ConditionalTheory, MemberData(nameof(IsAsyncData))]
public virtual async Task Json_predicate_on_interval(bool async)
{
var contextFactory = await InitializeAsync<TypesDbContext>(
var contextFactory = await InitializeNonSharedTest<TypesDbContext>(
seed: async context =>
{
context.Entities.AddRange(
Expand All @@ -220,7 +220,7 @@ public virtual async Task Json_predicate_on_interval(bool async)
await context.SaveChangesAsync();
});

using (var context = contextFactory.CreateContext())
using (var context = contextFactory.CreateDbContext())
{
var query = context.Entities.Where(x => x.JsonEntity.Interval == new TimeSpan(2, 2, 3, 4, 123, 456));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Microsoft.EntityFrameworkCore.Query;

public class AdHocManyToManyQueryNpgsqlTest(NonSharedFixture fixture) : AdHocManyToManyQueryRelationalTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Microsoft.EntityFrameworkCore.Query;

public class AdHocMiscellaneousQueryNpgsqlTest(NonSharedFixture fixture) : AdHocMiscellaneousQueryRelationalTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

protected override DbContextOptionsBuilder SetParameterizedCollectionMode(DbContextOptionsBuilder optionsBuilder, ParameterTranslationMode parameterizedCollectionMode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public class AdHocNavigationsQueryNpgsqlTest(NonSharedFixture fixture) : AdHocNa
public override Task Reference_include_on_derived_type_with_sibling_works()
=> Assert.ThrowsAsync<DbUpdateException>(() => base.Reference_include_on_derived_type_with_sibling_works());

protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public override async Task Projecting_entity_with_property_requiring_converter_w
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());

protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

protected override PrecompiledQueryTestHelpers PrecompiledQueryTestHelpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace Microsoft.EntityFrameworkCore.Query;
public class AdHocQueryFiltersQueryNpgsqlTest(NonSharedFixture fixture)
: AdHocQueryFiltersQueryRelationalTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.EntityFrameworkCore.Query;

public class AdHocQuerySplittingQueryNpgsqlTest(NonSharedFixture fixture) : AdHocQuerySplittingQueryTestBase(fixture)
{
protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

private static readonly FieldInfo _querySplittingBehaviorFieldInfo =
Expand Down Expand Up @@ -41,7 +41,7 @@ protected override DbContextOptionsBuilder ClearQuerySplittingBehavior(DbContext

protected override TestStore CreateTestStore25225()
{
var testStore = NpgsqlTestStore.Create(StoreName);
var testStore = NpgsqlTestStore.Create(NonSharedStoreName);
testStore.UseConnectionString = true;
return testStore;
}
Expand Down
11 changes: 4 additions & 7 deletions test/EFCore.PG.FunctionalTests/Query/ArrayQueryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Microsoft.EntityFrameworkCore.Query;

public abstract class ArrayQueryFixture : SharedStoreFixtureBase<ArrayQueryContext>, IQueryFixtureBase, ITestSqlLoggerFactory
public abstract class ArrayQueryFixture : QueryFixtureBase<ArrayQueryContext>, ITestSqlLoggerFactory
{
protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
Expand All @@ -18,19 +18,16 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build
protected override Task SeedAsync(ArrayQueryContext context)
=> ArrayQueryContext.SeedAsync(context);

public Func<DbContext> GetContextCreator()
=> CreateContext;

public ISetSource GetExpectedData()
public override ISetSource GetExpectedData()
=> _expectedData ??= new ArrayQueryData();

public IReadOnlyDictionary<Type, object> EntitySorters
public override IReadOnlyDictionary<Type, object> EntitySorters
=> new Dictionary<Type, Func<object, object?>>
{
{ typeof(ArrayEntity), e => ((ArrayEntity)e).Id }, { typeof(ArrayContainerEntity), e => ((ArrayContainerEntity)e)?.Id }
}.ToDictionary(e => e.Key, e => (object)e.Value);

public IReadOnlyDictionary<Type, object> EntityAsserters
public override IReadOnlyDictionary<Type, object> EntityAsserters
=> new Dictionary<Type, Action<object, object>>
{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,6 @@ public override async Task Tpc_entity_owning_a_split_collection_on_leaf(bool asy
AssertSql();
}

protected override ITestStoreFactory TestStoreFactory
protected override ITestStoreFactory NonSharedTestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
}
Loading
Loading