Skip to content

Commit 79497e5

Browse files
committed
Fix PostGIS tests
1 parent 9ef384b commit 79497e5

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

test/EntityFramework6.Npgsql.Tests/Spatial/PostgisServiceTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,5 +1821,26 @@ public void InstanceTest()
18211821
Assert.Fail();
18221822
}
18231823
}
1824+
1825+
[OneTimeSetUp]
1826+
public new void TestFixtureSetup()
1827+
{
1828+
using (var context = new BloggingContext(ConnectionString))
1829+
{
1830+
if (!context.Database.Exists())
1831+
context.Database.Create();
1832+
}
1833+
1834+
using (var conn = new NpgsqlConnection(ConnectionString))
1835+
{
1836+
conn.Open();
1837+
using (var cmd = new NpgsqlCommand("CREATE EXTENSION IF NOT EXISTS postgis", conn))
1838+
cmd.ExecuteNonQuery();
1839+
1840+
// Need to also have Npgsql reload the types from the database
1841+
conn.ReloadTypes();
1842+
NpgsqlConnection.ClearPool(conn);
1843+
}
1844+
}
18241845
}
18251846
}

test/EntityFramework6.Npgsql.Tests/Support/EntityFrameworkTestBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ namespace EntityFramework6.Npgsql.Tests
4141
public abstract class EntityFrameworkTestBase : TestBase
4242
{
4343
[OneTimeSetUp]
44-
public override void TestFixtureSetup()
44+
public new void TestFixtureSetup()
4545
{
46-
base.TestFixtureSetup();
4746
using (var context = new BloggingContext(ConnectionString))
4847
{
4948
if (context.Database.Exists())

0 commit comments

Comments
 (0)