LANCommander/LANCommander.Server.UI.Tests/ServerCollection.cs
Aaron Powell fd0c15bf8a Fix full test suite: use ICollectionFixture and remove Hangfire
- Switch all test classes from IClassFixture<ConfiguredServerFixture> to
  [Collection("Server")] with ICollectionFixture so a single server instance
  is shared across all test classes (avoids static DatabaseContext.Provider conflicts)
- Put FirstTimeSetupTests in its own collection since it needs an unconfigured server
- Remove Hangfire hosted services in UITestApplicationFactory to prevent
  stack overflow during process shutdown (deep DI disposal chain)
- Add graceful shutdown handling with timeout in DisposeAsync
- All 54 tests pass, 1 skipped, clean exit code 0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-08 08:25:44 +11:00

20 lines
752 B
C#

namespace LANCommander.Server.UI.Tests;
/// <summary>
/// xUnit collection definition that shares a single ConfiguredServerFixture across all
/// test classes in the "Server" collection. This avoids creating multiple WebApplicationFactory
/// instances that fight over the static DatabaseContext.Provider.
/// </summary>
[CollectionDefinition("Server")]
public class ServerCollection : ICollectionFixture<ConfiguredServerFixture>
{
}
/// <summary>
/// Separate collection for FirstTimeSetupTests which needs its own unconfigured server.
/// Having it in its own collection ensures it doesn't share state with the Server collection.
/// </summary>
[CollectionDefinition("FirstTimeSetup")]
public class FirstTimeSetupCollection
{
}