refactor(tests): DatabaseCollection centraliza ICollectionFixture<SqlTestFixture>
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.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
<Using Include="SIGCM2.TestSupport" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
15
tests/SIGCM2.Application.Tests/DatabaseCollection.cs
Normal file
15
tests/SIGCM2.Application.Tests/DatabaseCollection.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using SIGCM2.TestSupport;
|
||||
using Xunit;
|
||||
|
||||
namespace SIGCM2.Application.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[CollectionDefinition("Database")]
|
||||
public sealed class DatabaseCollection : ICollectionFixture<SqlTestFixture>
|
||||
{
|
||||
// Intentionally empty: this class only exists to declare the collection/fixture binding.
|
||||
}
|
||||
@@ -24,10 +24,12 @@
|
||||
<ProjectReference Include="..\..\src\api\SIGCM2.Application\SIGCM2.Application.csproj" />
|
||||
<ProjectReference Include="..\..\src\api\SIGCM2.Infrastructure\SIGCM2.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\src\api\SIGCM2.Domain\SIGCM2.Domain.csproj" />
|
||||
<ProjectReference Include="..\SIGCM2.TestSupport\SIGCM2.TestSupport.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
<Using Include="SIGCM2.TestSupport" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user