forked from PhenX/PhenX.EntityFrameworkCore.BulkInsert
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDbContainerPostgreSql.cs
More file actions
38 lines (28 loc) · 1.22 KB
/
TestDbContainerPostgreSql.cs
File metadata and controls
38 lines (28 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Data.Common;
using Microsoft.EntityFrameworkCore;
using Npgsql;
using PhenX.EntityFrameworkCore.BulkInsert.PostgreSql;
using Testcontainers.PostgreSql;
using Xunit;
using Xunit.Abstractions;
namespace PhenX.EntityFrameworkCore.BulkInsert.Tests.DbContainer;
[CollectionDefinition(Name)]
public class TestDbContainerPostgreSqlCollection : ICollectionFixture<TestDbContainerPostgreSql>
{
public const string Name = "PostgreSql";
}
public class TestDbContainerPostgreSql(IMessageSink messageSink) : TestDbContainer<PostgreSqlBuilder, PostgreSqlContainer>(messageSink)
{
public override DbProviderFactory DbProviderFactory => NpgsqlFactory.Instance;
// GeoSpatial support, using imresamu/postgis instead of postgis/postgis for arm64 support, see https://github.com/postgis/docker-postgis/issues/216#issuecomment-2936824962
protected override PostgreSqlBuilder CreateBuilder() => new("imresamu/postgis:17-3.5");
protected override void Configure(DbContextOptionsBuilder optionsBuilder, string databaseName)
{
optionsBuilder
.UseNpgsql(GetConnectionString(databaseName), o =>
{
o.UseNetTopologySuite();
})
.UseBulkInsertPostgreSql();
}
}