XBullet.EasyTesting.Testcontainers
1.0.4
See the version list below for details.
dotnet add package XBullet.EasyTesting.Testcontainers --version 1.0.4
NuGet\Install-Package XBullet.EasyTesting.Testcontainers -Version 1.0.4
<PackageReference Include="XBullet.EasyTesting.Testcontainers" Version="1.0.4" />
<PackageVersion Include="XBullet.EasyTesting.Testcontainers" Version="1.0.4" />
<PackageReference Include="XBullet.EasyTesting.Testcontainers" />
paket add XBullet.EasyTesting.Testcontainers --version 1.0.4
#r "nuget: XBullet.EasyTesting.Testcontainers, 1.0.4"
#:package XBullet.EasyTesting.Testcontainers@1.0.4
#addin nuget:?package=XBullet.EasyTesting.Testcontainers&version=1.0.4
#tool nuget:?package=XBullet.EasyTesting.Testcontainers&version=1.0.4
XBullet.EasyTesting.Testcontainers
Scenario-scoped PostgreSQL, SQL Server, Kafka, Redis, RabbitMQ, Azurite, and Azure Service Bus emulator infrastructure powered by Testcontainers for .NET.
The package targets .NET 8 and .NET 10 and requires a Docker-compatible container runtime.
Install
dotnet add package XBullet.EasyTesting.Testcontainers
Built-in modules
using var factory = EasyTestHost.Create<Program>()
.UsePostgreSql(options =>
{
options.ConfigurationKey = "ConnectionStrings:Orders";
options.ConfigureBuilder(builder => builder
.WithDatabase("orders")
.WithUsername("orders_test"));
})
.UseRedis()
.Build();
await using var scope = await factory.CreateTestScenarioScopeAsync();
var postgres = scope.GetTestcontainer<Program, PostgreSqlContainer>("PostgreSql");
Each module uses the native Testcontainers readiness strategy. The scenario application starts only after every container is ready and its mapped endpoint has been added to configuration. Containers are disposed in reverse registration order after the application host.
The default configuration keys are:
- PostgreSQL:
ConnectionStrings:PostgreSql - SQL Server:
ConnectionStrings:SqlServer - Kafka:
Kafka:BootstrapServers - Redis:
ConnectionStrings:Redis - RabbitMQ:
ConnectionStrings:RabbitMq - Azurite:
ConnectionStrings:AzureStorage - Service Bus emulator:
ConnectionStrings:ServiceBus
Service Bus requires explicit license acceptance:
builder.UseServiceBusEmulator(acceptLicenseAgreement: true);
Arbitrary containers
Use UseTestcontainer for a native or custom module. Resolve configuration values only after the
container has started:
builder.UseTestcontainer(
"search",
_ => new ContainerBuilder("getmeili/meilisearch:v1.12.8")
.WithPortBinding(7700, assignRandomHostPort: true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(
request => request.ForPort(7700).ForPath("/health")))
.Build(),
container => new Dictionary<string, string?>
{
["Search:Endpoint"] = $"http://{container.Hostname}:{container.GetMappedPublicPort(7700)}"
},
configureServices: null,
maximumDiagnosticCharacters: 20_000);
Failure diagnostics contain container identity, image, state, health, mapped ports, and bounded stdout/stderr. Published configuration values are intentionally excluded because connection strings can contain credentials.
Runtime verification
The repository keeps real-service tests explicit so an ordinary unit-test run does not require Docker. Run the complete PostgreSQL, SQL Server, Kafka, Redis, RabbitMQ, Azurite, and Service Bus suite with:
dotnet test tests/XBullet.EasyTesting.ContainerTests/XBullet.EasyTesting.ContainerTests.csproj \
--configuration Release --explicit only
These slow tests are intentionally excluded from CI and are available for local or manually scheduled infrastructure verification.
| 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 was computed. 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
- Testcontainers.Azurite (>= 4.15.0)
- Testcontainers.Kafka (>= 4.15.0)
- Testcontainers.MsSql (>= 4.15.0)
- Testcontainers.PostgreSql (>= 4.15.0)
- Testcontainers.RabbitMq (>= 4.15.0)
- Testcontainers.Redis (>= 4.15.0)
- Testcontainers.ServiceBus (>= 4.15.0)
- XBullet.EasyTesting (>= 1.0.4)
-
net8.0
- Testcontainers.Azurite (>= 4.15.0)
- Testcontainers.Kafka (>= 4.15.0)
- Testcontainers.MsSql (>= 4.15.0)
- Testcontainers.PostgreSql (>= 4.15.0)
- Testcontainers.RabbitMq (>= 4.15.0)
- Testcontainers.Redis (>= 4.15.0)
- Testcontainers.ServiceBus (>= 4.15.0)
- XBullet.EasyTesting (>= 1.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.