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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ProtoTest.Sql.Testcontainers" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProtoTest.Sql.Testcontainers" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ProtoTest.Sql.Testcontainers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ProtoTest.Sql.Testcontainers --version 1.0.1
                    
#r "nuget: ProtoTest.Sql.Testcontainers, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ProtoTest.Sql.Testcontainers@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ProtoTest.Sql.Testcontainers&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ProtoTest.Sql.Testcontainers&version=1.0.1
                    
Install as a Cake Tool

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 — PostgresDatabase derives ProtoContainerResource<PostgreSqlContainer> with Id "database:postgres", Kind "database" and Description "PostgreSQL container"; the builder starts from the postgres:16-alpine image.
  • Factories — Container(configure?) builds without starting, Start(configure?) starts now or throws with the reason, and TryStart(configure, out database, out error) reports failure instead of throwing.
  • Registration — AddInfrastructure(database, "ConnectionStrings:Northstar") starts it with the host and fills the key; AddResource alone 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, ReleaseAsync and DisposeAsync.
  • Capability — none of its own: AddSql adds the SQL (store) capability, and fixture-level TryStart is the fallback when the runtime is missing.
  • Dependencies — depends only on ProtoTest.Testcontainers plus 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 49 9/20/2026
1.0.0 52 9/20/2026