test: dedupe the nested test doubles into one shared file

TestDbFactory was redeclared as a private nested class in 40 test files,
NullServiceProvider and StubNotesApi in 14 each, DefaultStub in 5 — 73
declarations, all semantically identical (StubNotesApi differed only in
formatting and type qualification). They now live in TestDoubles.cs next to the
existing StubWorkerClient, which was already the shared-double pattern in this
project.
This commit is contained in:
mika kuns
2026-08-26 10:11:58 +02:00
parent 81994aadca
commit 76d836a278
43 changed files with 36 additions and 428 deletions
@@ -21,11 +21,6 @@ public class WorktreesOverviewReconcileTickTests
=> Task.FromResult<MergeTargetsDto?>(new MergeTargetsDto("main", new[] { "main" }, "chore(list): merge t"));
}
private sealed class NoopMergeCoordinator : IMergeCoordinator
{
public Task ResolveConflictAsync(string taskId, string targetBranch) => Task.CompletedTask;
}
private static WorktreeOverviewDto Wt(string taskId, WorktreeState state = WorktreeState.Active) =>
new(taskId, $"Task {taskId}", TaskStatus.WaitingForReview, "L1", "Work",
$@"C:\wt\{taskId}", $"claudedo/{taskId}", "base0", state, "+1 -0",
@@ -35,7 +30,8 @@ public class WorktreesOverviewReconcileTickTests
{
var worker = new FakeWorker { Worktrees = { Wt("a"), Wt("b"), Wt("c") } };
var vm = new WorktreesOverviewModalViewModel(
worker, () => throw new InvalidOperationException("no diff vm in this test"), new NoopMergeCoordinator());
worker, () => throw new InvalidOperationException("no diff vm in this test"),
new ClaudeDo.Ui.Services.MergeCoordinator());
vm.Configure("L1", "Work");
await vm.LoadAsync();
return (vm, worker);