yavsc/src/Yavsc.Org
Paul Schneider 61b41f0c55
test(org): isolate in-memory store per fixture
TestWebApplicationFactory instances shared the same in-memory database
because EF Core's UseInMemoryDatabase("InMemory") returns the same
backing store to every DbContext that asks for it under the same
connection string, in the same process. Whichever fixture started
first defined the state, and every subsequent fixture inherited it,
making tests silently order-dependent and flaky.

Fix:

- Yavsc.Tests.Shared/InMemoryDatabaseName: helper that suffixes the
  in-memory connection string with a per-fixture GUID.
- TestWebApplicationFactory: instance GUID + ConnectionStrings__
  YavscConnection set as an environment variable in the constructor
  and cleared in Dispose, so each factory gets its own backing store.
  Env var is needed because IdentityServer8.EntityFramework exposes
  ConfigureDbContext as Action<DbContextOptionsBuilder> with no
  service-provider access, so the connection string is captured at
  registration time. AddEnvironmentVariables is the last provider in
  the config pipeline and wins regardless.
- WebServerFixture: process-static GUID (WebHostFixture is a
  per-process singleton by design, so the test collection shares one
  store; the GUID still isolates from TestWebApplicationFactory).
- AddIdentityDBAndStores: read the connection string at DbContext
  construction time via the (sp, options) overload of AddDbContext,
  so test fixtures can override it via the host's IConfiguration.
  IdentityServer stores cannot do the same without subclassing the
  framework's DbContexts; the env var path is the documented escape
  hatch in HostingExtensions.AddIdentityServer.
- UsesInMemoryProvider: StartsWith instead of equality, so
  'InMemory-{guid}' is still recognised as an in-memory connection
  string.

Regression sentinel in
Controllers/TestWebApplicationFactoryIsolationTests: two factories
seed a marker client in the first, the second must not see it.

Suite: 45/45 over 3 stable runs, 13-15s each.
2026-08-22 04:36:52 +01:00
..
Avatars-Dev reorg 2026-02-28 21:17:54 +00:00
Bills-Dev reorg 2026-02-28 21:17:54 +00:00
Controllers using clauses cleanup 2026-08-22 03:34:48 +01:00
data reorg 2026-02-28 21:17:54 +00:00
Data-Dev reorg 2026-02-28 21:17:54 +00:00
Extensions test(org): isolate in-memory store per fixture 2026-08-22 04:36:52 +01:00
Helpers using clauses cleanup 2026-08-22 03:34:48 +01:00
keys reorg 2026-02-28 21:17:54 +00:00
Migrations using clauses cleanup 2026-08-22 03:34:48 +01:00
Resources Localisation 2026-07-12 15:18:07 +01:00
Services using clauses cleanup 2026-08-22 03:34:48 +01:00
Temp-Dev reorg 2026-02-28 21:17:54 +00:00
ViewComponents using clauses cleanup 2026-08-22 03:34:48 +01:00
ViewModels using clauses cleanup 2026-08-22 03:34:48 +01:00
Views refacto API prefix + nav.back 2026-08-20 20:50:52 +01:00
wwwroot Add comments API support and tests 2026-08-10 22:27:52 +01:00
.eslintrc.json reorg 2026-02-28 21:17:54 +00:00
appsettings-org-template.json background colors 2026-06-20 19:20:22 +01:00
appsettings-org.json Audiences 2026-07-12 15:17:53 +01:00
appsettings-org.Testing.json Revert "repoduces the bug" 2026-07-11 22:17:58 +01:00
AssemblyInfo.cs test(yavsc.org): cover the kid derivation in ComputeKid 2026-07-09 20:28:58 +01:00
Contants.cs using clauses cleanup 2026-08-22 03:34:48 +01:00
CustomModelBinder.cs using clauses cleanup 2026-08-22 03:34:48 +01:00
Directory.Packages.props Identity reloaded 2026-07-05 23:56:10 +01:00
libman.json reorg 2026-02-28 21:17:54 +00:00
License.md reorg 2026-02-28 21:17:54 +00:00
Makefile reorg 2026-02-28 21:17:54 +00:00
noteLocalization.md reorg 2026-02-28 21:17:54 +00:00
Program.cs using clauses cleanup 2026-08-22 03:34:48 +01:00
Startup.cs reorg 2026-02-28 21:17:54 +00:00
tempkey.jwk reorg 2026-02-28 21:17:54 +00:00
Yavsc.Org.csproj chore(release): bump version via gitversion for 1.0.8-rc1 2026-08-18 19:18:36 +01:00