Testcontainers (.NET)
There is no MiniStack .NET module yet. The ministack repo ships a runnable example at Testcontainers/dotnet-testcontainers/ that starts MiniStack with Testcontainers for .NET and tests S3, SQS and DynamoDB with xUnit and the AWS SDK for .NET v4.
Run the example
It needs the .NET 10 SDK and a running Docker daemon. From Testcontainers/dotnet-testcontainers/:
dotnet test
Testcontainers pulls ministackorg/ministack:latest, starts it, runs the tests and removes the container.
xUnit fixture
One container is shared by a test class through IClassFixture. It maps port 4566 to a random host port and waits for /_ministack/health:
public sealed class MiniStackFixture : IAsyncLifetime
{
private readonly IContainer _container = new ContainerBuilder("ministackorg/ministack:latest")
.WithPortBinding(4566, true)
.WithEnvironment("GATEWAY_PORT", "4566")
.WithEnvironment("LOG_LEVEL", "INFO")
.WithWaitStrategy(Wait.ForUnixContainer()
.UntilHttpRequestIsSucceeded(r => r.ForPort(4566).ForPath("/_ministack/health")))
.Build();
public string Endpoint => $"http://{_container.Hostname}:{_container.GetMappedPublicPort(4566)}";
public AWSCredentials Credentials { get; } = new BasicAWSCredentials("test", "test");
public Task InitializeAsync() => _container.StartAsync();
public Task DisposeAsync() => _container.DisposeAsync().AsTask();
}
AWS SDK clients
Point each client at the fixture's endpoint with ServiceURL and sign for a region with AuthenticationRegion; S3 also needs ForcePathStyle. Any credentials work; the example uses test/test.
private AmazonS3Client S3() => new(_ministack.Credentials, new AmazonS3Config
{
ServiceURL = _ministack.Endpoint,
AuthenticationRegion = "us-east-1",
ForcePathStyle = true,
});
private AmazonSQSClient Sqs() => new(_ministack.Credentials, new AmazonSQSConfig
{
ServiceURL = _ministack.Endpoint,
AuthenticationRegion = "us-east-1",
});