From 03a695feb9ef724281ac12e95eb294967ae6c322 Mon Sep 17 00:00:00 2001 From: dmolinari Date: Sat, 18 Apr 2026 21:44:24 -0300 Subject: [PATCH] refactor(tests): DatabaseCollection centraliza ICollectionFixture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Registra la colección "Database" con SqlTestFixture como fixture compartido para Application.Tests (elimina el ctor-con-string inline en cada test class). Agrega Using global a ambos proyectos para evitar usings por archivo. --- tests/SIGCM2.Api.Tests/SIGCM2.Api.Tests.csproj | 1 + .../DatabaseCollection.cs | 15 +++++++++++++++ .../SIGCM2.Application.Tests.csproj | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 tests/SIGCM2.Application.Tests/DatabaseCollection.cs diff --git a/tests/SIGCM2.Api.Tests/SIGCM2.Api.Tests.csproj b/tests/SIGCM2.Api.Tests/SIGCM2.Api.Tests.csproj index b7f3581..872163a 100644 --- a/tests/SIGCM2.Api.Tests/SIGCM2.Api.Tests.csproj +++ b/tests/SIGCM2.Api.Tests/SIGCM2.Api.Tests.csproj @@ -27,6 +27,7 @@ + diff --git a/tests/SIGCM2.Application.Tests/DatabaseCollection.cs b/tests/SIGCM2.Application.Tests/DatabaseCollection.cs new file mode 100644 index 0000000..f3f6086 --- /dev/null +++ b/tests/SIGCM2.Application.Tests/DatabaseCollection.cs @@ -0,0 +1,15 @@ +using SIGCM2.TestSupport; +using Xunit; + +namespace SIGCM2.Application.Tests; + +/// +/// Declares the "Database" xUnit collection backed by a single shared SqlTestFixture. +/// All test classes decorated with [Collection("Database")] share one fixture instance +/// per test run — eliminating concurrent Respawner collisions. +/// +[CollectionDefinition("Database")] +public sealed class DatabaseCollection : ICollectionFixture +{ + // Intentionally empty: this class only exists to declare the collection/fixture binding. +} diff --git a/tests/SIGCM2.Application.Tests/SIGCM2.Application.Tests.csproj b/tests/SIGCM2.Application.Tests/SIGCM2.Application.Tests.csproj index d94bcf5..8c51a38 100644 --- a/tests/SIGCM2.Application.Tests/SIGCM2.Application.Tests.csproj +++ b/tests/SIGCM2.Application.Tests/SIGCM2.Application.Tests.csproj @@ -24,10 +24,12 @@ + +