Skip to content

Commit

Permalink
Test fixes for Npgsql 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Nov 9, 2022
1 parent 20a1e1a commit 721c2bd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query;

public class SpatialQueryNpgsqlFixture : SpatialQueryRelationalFixture
{
protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

protected override IServiceCollection AddServices(IServiceCollection serviceCollection)
#pragma warning disable CS0618 // GlobalTypeMapper is obsolete
public SpatialQueryNpgsqlFixture()
{
#pragma warning disable CS0618 // NpgsqlConnection.GlobalTypeMapper is obsolete
NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite();
}
#pragma warning restore CS0618

return base.AddServices(serviceCollection)
.AddEntityFrameworkNpgsqlNetTopologySuite();
}
protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

protected override IServiceCollection AddServices(IServiceCollection serviceCollection)
=> base.AddServices(serviceCollection).AddEntityFrameworkNpgsqlNetTopologySuite();

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
7 changes: 7 additions & 0 deletions test/EFCore.PG.FunctionalTests/SpatialNpgsqlFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL;

public class SpatialNpgsqlFixture : SpatialFixtureBase
{
#pragma warning disable CS0618 // GlobalTypeMapper is obsolete
public SpatialNpgsqlFixture()
{
NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite();
}
#pragma warning restore CS0618

protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,13 @@ public class NodaTimeQueryNpgsqlFixture : SharedStoreFixtureBase<NodaTimeContext
{
protected override string StoreName => "NodaTimeTest";

#pragma warning disable CS0618 // GlobalTypeMapper is obsolete
public NodaTimeQueryNpgsqlFixture()
{
NpgsqlConnection.GlobalTypeMapper.UseNodaTime();
}
#pragma warning restore CS0618

// Set the PostgreSQL TimeZone parameter to something local, to ensure that operations which take TimeZone into account
// don't depend on the database's time zone, and also that operations which shouldn't take TimeZone into account indeed
// don't.
Expand Down

0 comments on commit 721c2bd

Please sign in to comment.