ProtoTest.Sql.Testcontainers
1.0.1
dotnet add package ProtoTest.Sql.Testcontainers --version 1.0.1
NuGet\Install-Package ProtoTest.Sql.Testcontainers -Version 1.0.1
<PackageReference Include="ProtoTest.Sql.Testcontainers" Version="1.0.1" />
<PackageVersion Include="ProtoTest.Sql.Testcontainers" Version="1.0.1" />
<PackageReference Include="ProtoTest.Sql.Testcontainers" />
paket add ProtoTest.Sql.Testcontainers --version 1.0.1
#r "nuget: ProtoTest.Sql.Testcontainers, 1.0.1"
#:package ProtoTest.Sql.Testcontainers@1.0.1
#addin nuget:?package=ProtoTest.Sql.Testcontainers&version=1.0.1
#tool nuget:?package=ProtoTest.Sql.Testcontainers&version=1.0.1
ProtoTest.Sql.Testcontainers
A PostgreSQL container owned by the whole run, for suites that want a real server instead of an in-process database.
dotnet add package ProtoTest.Sql.Testcontainers
Quick start
var database = PostgresDatabase.Container(container => container.WithImage("postgres:17-alpine"));
builder.AddInfrastructure(database, "ConnectionStrings:Northstar");
// The host starts the container and fills the key for the application under test;
// the resource itself exposes the same started connection string.
services.AddNorthstarDomain(options => options.UseNpgsql(database.ConnectionString));
What it adds
- Container resource —
PostgresDatabasederivesProtoContainerResource<PostgreSqlContainer>withId "database:postgres",Kind "database"andDescription "PostgreSQL container"; the builder starts from thepostgres:16-alpineimage. - Factories —
Container(configure?)builds without starting,Start(configure?)starts now or throws with the reason, andTryStart(configure, out database, out error)reports failure instead of throwing. - Registration —
AddInfrastructure(database, "ConnectionStrings:Northstar")starts it with the host and fills the key;AddResourcealone only owns its release. - Lifecycle — start-once per run with a shared start task; released when the host is disposed, after the run stopped and the reports were written.
- Surface — inherited
ConnectionString(empty until started),IsStarted,StartAsync,ReleaseAsyncandDisposeAsync. - Capability — none of its own:
AddSqladds theSQL(store) capability, and fixture-levelTryStartis the fallback when the runtime is missing. - Dependencies — depends only on
ProtoTest.Testcontainersplus the Testcontainers PostgreSQL module, so the container API stays out of Core. - Alternative — a connection string for an external PostgreSQL server is ordinary configuration; this package is only for the suite that wants to own one.
Configuration
No options type of its own: the image and container settings come from the PostgreSqlBuilder passed to Container/Start/TryStart, and the connection string flows through the keys passed to AddInfrastructure — caller-supplied strings, not a bound section.
The container starts with the host — before any test-level skip condition — so a missing container runtime fails the run at start. Use TryStart in the suite fixture before registering to choose another mode or skip the suite, and note there is no per-test database reset.
Learn more
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Testcontainers (>= 1.0.1)
- Testcontainers.PostgreSql (>= 4.15.0)
-
net8.0
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Testcontainers (>= 1.0.1)
- Testcontainers.PostgreSql (>= 4.15.0)
-
net9.0
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Testcontainers (>= 1.0.1)
- Testcontainers.PostgreSql (>= 4.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.