diff --git a/tests/Heimdall.Infrastructure.Tests/CameraAssignmentServiceTests.cs b/tests/Heimdall.Infrastructure.Tests/CameraAssignmentServiceTests.cs
index fb2dc77..f85178c 100644
--- a/tests/Heimdall.Infrastructure.Tests/CameraAssignmentServiceTests.cs
+++ b/tests/Heimdall.Infrastructure.Tests/CameraAssignmentServiceTests.cs
@@ -9,6 +9,8 @@ using Microsoft.Extensions.Logging;
using NSubstitute;
using Shouldly;
+using Heimdall.TestCommon;
+
namespace Heimdall.Infrastructure.Tests;
[Collection("PostgresInfra")]
diff --git a/tests/Heimdall.Infrastructure.Tests/CameraEventServiceTests.cs b/tests/Heimdall.Infrastructure.Tests/CameraEventServiceTests.cs
index 2831244..cefc7e9 100644
--- a/tests/Heimdall.Infrastructure.Tests/CameraEventServiceTests.cs
+++ b/tests/Heimdall.Infrastructure.Tests/CameraEventServiceTests.cs
@@ -10,6 +10,8 @@ using Microsoft.Extensions.Logging;
using NSubstitute;
using Shouldly;
+using Heimdall.TestCommon;
+
namespace Heimdall.Infrastructure.Tests;
[Collection("PostgresInfra")]
diff --git a/tests/Heimdall.Infrastructure.Tests/Heimdall.Infrastructure.Tests.csproj b/tests/Heimdall.Infrastructure.Tests/Heimdall.Infrastructure.Tests.csproj
index 8335317..89164d3 100644
--- a/tests/Heimdall.Infrastructure.Tests/Heimdall.Infrastructure.Tests.csproj
+++ b/tests/Heimdall.Infrastructure.Tests/Heimdall.Infrastructure.Tests.csproj
@@ -12,7 +12,6 @@
-
@@ -23,6 +22,7 @@
+
\ No newline at end of file
diff --git a/tests/Heimdall.Infrastructure.Tests/PostgreSqlContainerFixture.cs b/tests/Heimdall.Infrastructure.Tests/PostgreSqlContainerFixture.cs
deleted file mode 100644
index d1569ca..0000000
--- a/tests/Heimdall.Infrastructure.Tests/PostgreSqlContainerFixture.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-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.
-/// In CI mode (DATABASE_URL env var), uses the CI-provided PostgreSQL service
-/// instead of starting a Testcontainer.
-///
-public class PostgreSqlContainerFixture : IAsyncLifetime
-{
- private readonly PostgreSqlContainer? _container;
- private readonly string _connectionString;
-
- public string ConnectionString => _connectionString;
-
- public PostgreSqlContainerFixture()
- {
- var envUrl = Environment.GetEnvironmentVariable("DATABASE_URL");
- if (!string.IsNullOrEmpty(envUrl))
- {
- // CI mode — use the CI-provided PostgreSQL service
- _connectionString = envUrl;
- _container = null;
- }
- else
- {
- // Local dev — start a Testcontainer
- _container = new PostgreSqlBuilder("postgres:17-alpine")
- .WithDatabase("heimdall_test")
- .WithUsername("heimdall")
- .WithPassword("heimdall_test_pwd")
- .WithCleanUp(true)
- .Build();
- _connectionString = _container.GetConnectionString();
- }
- }
-
- public async Task InitializeAsync()
- {
- if (_container is not null)
- await _container.StartAsync();
- }
-
- public async Task DisposeAsync()
- {
- if (_container is not null)
- await _container.DisposeAsync();
- }
-}
-
-[CollectionDefinition("PostgresInfra")]
-public class PostgresInfraFixture : ICollectionFixture
-{
-}
diff --git a/tests/Heimdall.Infrastructure.Tests/PostgresInfraCollection.cs b/tests/Heimdall.Infrastructure.Tests/PostgresInfraCollection.cs
new file mode 100644
index 0000000..628ee03
--- /dev/null
+++ b/tests/Heimdall.Infrastructure.Tests/PostgresInfraCollection.cs
@@ -0,0 +1,12 @@
+using Heimdall.TestCommon;
+
+namespace Heimdall.Infrastructure.Tests;
+
+///
+/// Collection definition for Infrastructure tests that need PostgreSQL.
+/// Uses the shared from Heimdall.TestCommon.
+///
+[CollectionDefinition("PostgresInfra")]
+public sealed class PostgresInfraDefinition : ICollectionFixture
+{
+}
diff --git a/tests/Heimdall.IntegrationTests/Controllers/GlobalUsings.cs b/tests/Heimdall.IntegrationTests/Controllers/GlobalUsings.cs
new file mode 100644
index 0000000..17fb09d
--- /dev/null
+++ b/tests/Heimdall.IntegrationTests/Controllers/GlobalUsings.cs
@@ -0,0 +1 @@
+global using Heimdall.TestCommon;
diff --git a/tests/Heimdall.IntegrationTests/Controllers/PostgresCollection.cs b/tests/Heimdall.IntegrationTests/Controllers/PostgresCollection.cs
new file mode 100644
index 0000000..1dc2d6c
--- /dev/null
+++ b/tests/Heimdall.IntegrationTests/Controllers/PostgresCollection.cs
@@ -0,0 +1,12 @@
+using Heimdall.TestCommon;
+
+namespace Heimdall.IntegrationTests.Controllers;
+
+///
+/// Collection definition for Integration tests that need PostgreSQL.
+/// Uses the shared from Heimdall.TestCommon.
+///
+[CollectionDefinition("Postgres")]
+public sealed class PostgresDefinition : ICollectionFixture
+{
+}
diff --git a/tests/Heimdall.IntegrationTests/Controllers/PostgresTestBase.cs b/tests/Heimdall.IntegrationTests/Controllers/PostgresTestBase.cs
index c83d5e5..835ea74 100644
--- a/tests/Heimdall.IntegrationTests/Controllers/PostgresTestBase.cs
+++ b/tests/Heimdall.IntegrationTests/Controllers/PostgresTestBase.cs
@@ -1,6 +1,7 @@
using Heimdall.Infrastructure.Data;
using Heimdall.Infrastructure.Data.Interceptors;
using Heimdall.IntegrationTests.Factories;
+using Heimdall.TestCommon;
using Microsoft.EntityFrameworkCore;
namespace Heimdall.IntegrationTests.Controllers;
@@ -8,7 +9,7 @@ namespace Heimdall.IntegrationTests.Controllers;
///
/// Base class for integration tests that need a real PostgreSQL database
/// via Testcontainers. All test classes in the "Postgres" collection share
-/// the same PostgreSQL container.
+/// the same PostgreSQL database.
/// Resets the database before each test to guarantee isolation.
///
[Collection("Postgres")]
diff --git a/tests/Heimdall.IntegrationTests/Factories/PostgreSqlContainerFixture.cs b/tests/Heimdall.IntegrationTests/Factories/PostgreSqlContainerFixture.cs
deleted file mode 100644
index 7754bf0..0000000
--- a/tests/Heimdall.IntegrationTests/Factories/PostgreSqlContainerFixture.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using Testcontainers.PostgreSql;
-
-namespace Heimdall.IntegrationTests.Factories;
-
-///
-/// xUnit collection fixture that manages a PostgreSQL Testcontainer
-/// for integration tests. One container per test collection (shared
-/// across all test classes in the same collection).
-/// In CI mode (DATABASE_URL env var), uses the CI-provided PostgreSQL
-/// service instead of starting a Testcontainer.
-///
-public class PostgreSqlContainerFixture : IAsyncLifetime
-{
- private readonly PostgreSqlContainer? _container;
- private readonly string _connectionString;
-
- /// Connection string for the running PostgreSQL instance.
- public string ConnectionString => _connectionString;
-
- public PostgreSqlContainerFixture()
- {
- var envUrl = Environment.GetEnvironmentVariable("DATABASE_URL");
- if (!string.IsNullOrEmpty(envUrl))
- {
- // CI mode — use the CI-provided PostgreSQL service
- _connectionString = envUrl;
- _container = null;
- }
- else
- {
- // Local dev — start a Testcontainer
- _container = new PostgreSqlBuilder("postgres:17-alpine")
- .WithDatabase("heimdall_test")
- .WithUsername("heimdall")
- .WithPassword("heimdall_test_pwd")
- .WithCleanUp(true)
- .Build();
- _connectionString = _container.GetConnectionString();
- }
- }
-
- public async Task InitializeAsync()
- {
- if (_container is not null)
- await _container.StartAsync();
- }
-
- public async Task DisposeAsync()
- {
- if (_container is not null)
- await _container.DisposeAsync();
- }
-}
-
-///
-/// Defines the "Postgres" test collection. All test classes in this
-/// collection share the same PostgreSQL container via the fixture.
-///
-[CollectionDefinition("Postgres")]
-public class PostgresCollectionFixture : ICollectionFixture
-{
-}
diff --git a/tests/Heimdall.IntegrationTests/Heimdall.IntegrationTests.csproj b/tests/Heimdall.IntegrationTests/Heimdall.IntegrationTests.csproj
index 3e10e2e..dd728e9 100644
--- a/tests/Heimdall.IntegrationTests/Heimdall.IntegrationTests.csproj
+++ b/tests/Heimdall.IntegrationTests/Heimdall.IntegrationTests.csproj
@@ -10,11 +10,9 @@
-
-
@@ -26,6 +24,7 @@
+
\ No newline at end of file
diff --git a/tests/Heimdall.TestCommon/Heimdall.TestCommon.csproj b/tests/Heimdall.TestCommon/Heimdall.TestCommon.csproj
new file mode 100644
index 0000000..608d705
--- /dev/null
+++ b/tests/Heimdall.TestCommon/Heimdall.TestCommon.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net10.0
+ enable
+ enable
+ false
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/Heimdall.TestCommon/PostgreSqlContainerFixture.cs b/tests/Heimdall.TestCommon/PostgreSqlContainerFixture.cs
new file mode 100644
index 0000000..88106d0
--- /dev/null
+++ b/tests/Heimdall.TestCommon/PostgreSqlContainerFixture.cs
@@ -0,0 +1,33 @@
+using Testcontainers.PostgreSql;
+using Xunit;
+
+namespace Heimdall.TestCommon;
+
+///
+/// xUnit collection fixture that manages ONE PostgreSQL Testcontainer
+/// for ALL database-dependent tests across test projects.
+///
+public sealed 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();
+ }
+}
+
+// Collection definitions are in each test project assembly
+// (xUnit requires [CollectionDefinition] in the same assembly as the test).