Testcontainers for .Net

Thanks, I dfid add logging and was able to see the connection string. In fact I did the following (for anyone who needs to do the same thing)

1 - Add logging setup to CustomerServiceTest.cs, create ILoggerFactory, log container lifecycle events, route Testcontainers logs if possible.

private readonly ILoggerFactory _loggerFactory = LoggerFactory.Create(builder =>
{
builder
.AddConsole()
.SetMinimumLevel(LogLevel.Debug);
});

private readonly ILogger<CustomerServiceTest> _logger;

public CustomerServiceTest()
{
    // Logger factory is used to log test lifecycle events.
    _logger = _loggerFactory.CreateLogger<CustomerServiceTest>();
}

2 - Added a PackageReference for Microsoft.Extensions.Logging.Console

Then added logging in different places as follows, for example in InitializeAsync method

public async Task InitializeAsync()

    {

        _logger.LogDebug("Starting PostgreSQL testcontainer...");

        await _postgres.StartAsync();

        _logger.LogDebug("PostgreSQL testcontainer started. Connection string: {ConnectionString}", _postgres.GetConnectionString());

    }