diff --git a/src/Services/Catalog/Catalog.API.IntegrationTests/Catalog.API.IntegrationTests.csproj b/src/Services/Catalog/Catalog.API.IntegrationTests/Catalog.API.IntegrationTests.csproj index 18af8c3..771956d 100644 --- a/src/Services/Catalog/Catalog.API.IntegrationTests/Catalog.API.IntegrationTests.csproj +++ b/src/Services/Catalog/Catalog.API.IntegrationTests/Catalog.API.IntegrationTests.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/Services/Catalog/Catalog.API.IntegrationTests/Database/TestDatabase.cs b/src/Services/Catalog/Catalog.API.IntegrationTests/Database/TestDatabase.cs index c12950d..09376bb 100644 --- a/src/Services/Catalog/Catalog.API.IntegrationTests/Database/TestDatabase.cs +++ b/src/Services/Catalog/Catalog.API.IntegrationTests/Database/TestDatabase.cs @@ -1,6 +1,25 @@ +using Testcontainers.PostgreSql; + namespace Catalog.API.IntegrationTests.Database; -public class TestDatabase +public sealed class TestDatabase { - + private readonly PostgreSqlContainer _container = + new PostgreSqlBuilder() + .WithDatabase("CatalogDb") + .WithUsername("postgres") + .WithPassword("postgres") + .Build(); + + public string ConnectionString => _container.GetConnectionString(); + + public async Task StartAsync() + { + await _container.StartAsync(); + } + + public async Task StopAsync() + { + await _container.StopAsync(); + } } \ No newline at end of file