using Testcontainers.PostgreSql; namespace Heimdall.Infrastructure.Tests; /// /// xUnit collection fixture that manages a PostgreSQL Testcontainer. /// One container per test collection — shared across all test classes. /// public class PostgreSqlContainerFixture : IAsyncLifetime { private readonly PostgreSqlContainer _container = new PostgreSqlBuilder("postgres:17-alpine") .WithDatabase("heimdall_test") .WithUsername("heimdall") .WithPassword("heimdall_test_pwd") .WithCleanUp(true) .Build(); public string ConnectionString => _container.GetConnectionString(); public async Task InitializeAsync() { await _container.StartAsync(); } public async Task DisposeAsync() { await _container.DisposeAsync(); } } [CollectionDefinition("PostgresInfra")] public class PostgresInfraFixture : ICollectionFixture { }