Precept.Containers
Docker-backed dependencies for Precept runs, through Testcontainers. A service is started once per run, on first use, and the tests are handed its address.
dotnet add package Precept.Containers
services.AddPreceptContainers(host => host.Register(
"greeter",
"my/greeter:latest",
c => c.WithPortBinding(5000, true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(5000)),
addressOverride: settings.Configuration["Greeter:Address"]));
addressOverride is the point of the module. When it is set, no container starts and the tests
are handed that address instead. The same suite then runs against a throwaway container on a
developer's machine and against a deployed environment in CI, with the environment overlay
deciding which, and no if in the tests.
Part of Precept, a .NET 10 test framework built on Microsoft.Testing.Platform. Full documentation: containers · environments · startup