ProtoTest.Testcontainers
1.0.1
dotnet add package ProtoTest.Testcontainers --version 1.0.1
NuGet\Install-Package ProtoTest.Testcontainers -Version 1.0.1
<PackageReference Include="ProtoTest.Testcontainers" Version="1.0.1" />
<PackageVersion Include="ProtoTest.Testcontainers" Version="1.0.1" />
<PackageReference Include="ProtoTest.Testcontainers" />
paket add ProtoTest.Testcontainers --version 1.0.1
#r "nuget: ProtoTest.Testcontainers, 1.0.1"
#:package ProtoTest.Testcontainers@1.0.1
#addin nuget:?package=ProtoTest.Testcontainers&version=1.0.1
#tool nuget:?package=ProtoTest.Testcontainers&version=1.0.1
ProtoTest.Testcontainers
The ProtoContainerResource<TContainer> base for run-scoped containers: start-once, release-once and TryStart, with no container-library dependency of its own.
dotnet add package ProtoTest.Testcontainers
Technology packages build on it — ProtoTest.Sql.Testcontainers and ProtoTest.Messaging.RabbitMq.Testcontainers — each keeping its own Testcontainers module dependency.
Quick start
public sealed class SearchIndexContainer : ProtoContainerResource<PostgreSqlContainer>
{
public SearchIndexContainer() : base(
() => new PostgreSqlBuilder("postgres:16-alpine").Build(),
(container, cancellationToken) => container.StartAsync(cancellationToken),
container => container.GetConnectionString())
{
}
public override string Id => "search:postgres";
public override string Kind => "search";
public override string Description => "PostgreSQL search index";
}
// The host starts it before the run and fills the key for tests and applications alike.
builder.AddInfrastructure(new SearchIndexContainer(), "Search:Postgres:ConnectionString");
What it adds
- Run-scoped resource —
ScopeisProtoResourceScope.Run;ConnectionStringis empty until the container starts andIsStartedreports the state. - Start semantics — concurrent callers await one cached start task, a failed start stays retryable, and
StartAsyncafter release throwsObjectDisposedException. - Fixture fallback —
TryStartContainerstarts a candidate synchronously and returns"{ExceptionType}: {message}"instead of throwing, so a fixture can fall back or skip. - Registration contract —
AddInfrastructureowns and starts the resource;AddResourcealone only registers it for release and starts nothing.
A container runtime is required at host start and there is no built-in skip; a missing runtime fails the run before any test-level skip condition is evaluated.
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)
-
net8.0
- ProtoTest.Core (>= 1.0.1)
-
net9.0
- ProtoTest.Core (>= 1.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ProtoTest.Testcontainers:
| Package | Downloads |
|---|---|
|
ProtoTest.Messaging.RabbitMq.Testcontainers
A RabbitMQ container owned as a run-scoped resource for ProtoTest.Messaging.RabbitMq. |
|
|
ProtoTest.Sql.Testcontainers
A database container owned as a run-scoped resource for ProtoTest.Sql. |
GitHub repositories
This package is not used by any popular GitHub repositories.