1.7 KiB
1.7 KiB
ClaudeDo.Worker.Tests
xUnit integration tests for the Worker and Data layers. One of six test projects under tests/ (also: ClaudeDo.Data.Tests, ClaudeDo.Ui.Tests, ClaudeDo.Localization.Tests, ClaudeDo.Installer.Tests, ClaudeDo.Releases.Tests).
Framework
- xUnit 2.5.3 with
xunit.runner.visualstudio - No mocking library — custom sealed fakes (
Infrastructure/FakeClaudeProcess,CapturingHubContext/CapturingHubClients/CapturingClientProxyfor SignalR; file-local fakes for scoped tests) - Real SQLite databases per test via
DbFixture - Real git repos for worktree tests via
GitRepoFixture - coverlet for coverage collection
Test Infrastructure
- DbFixture — creates unique temp SQLite DB, applies schema, cleans up DB + WAL/SHM files on dispose
- GitRepoFixture — creates temp git repo with initial commit, configures user/email, handles Windows read-only .git cleanup. Tests skip if git is unavailable.
Test Areas
Test folders mirror the Worker source folders (Repositories, Runner, Queue, State,
Planning, Prime, Report, External, Lifecycle, Hub, UiSchema, UiVm) — ls the
folder rather than trusting an inventory here. UiSchema/UiVm cover UI-facing DTO schemas and
viewmodel behaviour driven from Worker fakes.
Conventions
- Test classes implement
IDisposableand create fixtures in constructor - Helper factory methods for entities:
MakeTask(),CreateListAsync(),SeedListAsync() - Concurrency tests use
TaskCompletionSourceas gates for deterministic ordering - Git-dependent tests are conditionally skipped via
Skip = ...when git is not available
Running
dotnet test tests/ClaudeDo.Worker.Tests