GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — DotNetCodingAgent/tests/DotNetCodingAgent.Tests/P9StepTests.cs at main · ackamen/DotNetCodingAgent Expand file tree/ Copy pathP9StepTests.csMore file actions 131 lines (123 loc) · 4.77 KB / Copy pathP9StepTests.csFile metadata and controls131 lines (123 loc) · 4.77 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 using DotNetCodingAgent.Core.Orchestration; using DotNetCodingAgent.Core.Orchestration.Steps; using DotNetCodingAgent.Wtg.Git; using DotNetCodingAgent.Wtg.Steps; using FluentAssertions; using Xunit; namespace DotNetCodingAgent.Tests; public class P9StepTests { private static StepExecutionContext NewCtx(string taskId, bool withWorktrees = true) { var root = Path.Combine(Path.GetTempPath(), "dn-p9-" + Guid.NewGuid().ToString("N")); Directory.CreateDirectory(root); var docs = new RuntimeDocsManager(root, "test-coding-v2"); docs.EnsureSkeleton(); var ctx = new StepExecutionContext { WorkDirectory = root, Docs = docs, Logger = new ActionLogger(docs.LogPath), State = docs.ReadState(), Todo = docs.ReadTodo() }; ctx.State.Wi = "WI001"; ctx.State.Title = "Demo"; if (withWorktrees) { ctx.State.Worktrees.Add(new WorktreeRecord { Repo = "Glow", MainPath = "m", WorktreePath = "wt", Branch = "feature/WI001-demo" }); } ctx.Todo.Items.Add(new TaskItem { TaskId = taskId, Title = "x" }); return ctx; } [Fact] public async Task Step21_passes_when_all_steps_completed_with_evidence() { var ctx = NewCtx("step-21"); foreach (var def in TestCodingV2StepCatalog.Steps) { if (def.TaskId == "step-21") continue; ctx.Todo.Items.Add(new TaskItem { TaskId = def.TaskId, Title = def.Title, Status = TodoStatus.Completed, EvidencePath = "x.md" }); } var r = await new Step21_AuditLocalCompletionGate().ExecuteAsync(ctx); r.Verdict.Should().Be(Verdict.Pass); File.Exists(r.EvidencePath!).Should().BeTrue(); } [Fact] public async Task Step21_fails_with_HardGateFail_when_step_incomplete() { var ctx = NewCtx("step-21"); foreach (var def in TestCodingV2StepCatalog.Steps) { if (def.TaskId == "step-21") continue; ctx.Todo.Items.Add(new TaskItem { TaskId = def.TaskId, Title = def.Title, Status = def.TaskId == "step-15" ? TodoStatus.Blocked : TodoStatus.Completed, EvidencePath = def.TaskId == "step-15" ? null : "x.md" }); } var r = await new Step21_AuditLocalCompletionGate().ExecuteAsync(ctx); r.Verdict.Should().Be(Verdict.Fail); r.FailureCode.Should().Be(FailureCode.HardGateFail); } [Fact] public async Task Step21_fails_when_state_has_failure_code() { var ctx = NewCtx("step-21"); ctx.State.FailureCode = FailureCode.StaticGateFail; foreach (var def in TestCodingV2StepCatalog.Steps) { if (def.TaskId == "step-21") continue; ctx.Todo.Items.Add(new TaskItem { TaskId = def.TaskId, Title = def.Title, Status = TodoStatus.Completed, EvidencePath = "x.md" }); } var r = await new Step21_AuditLocalCompletionGate().ExecuteAsync(ctx); r.Verdict.Should().Be(Verdict.Fail); } [Fact] public async Task Step22_commits_pushes_and_creates_pr_per_worktree() { var ctx = NewCtx("step-22"); ctx.State.Worktrees.Add(new WorktreeRecord { Repo = "CargoWise", MainPath = "m2", WorktreePath = "wt2", Branch = "feature/WI001-demo" }); var pusher = new StubGitPusher(); var pr = new StubPullRequestService(); var r = await new Step22_CommitPushCreatePullRequest(pusher, pr).ExecuteAsync(ctx); r.Verdict.Should().Be(Verdict.Pass); pusher.Commits.Should().HaveCount(2); pusher.Pushes.Should().HaveCount(2); pr.Calls.Should().HaveCount(2); pr.Calls[0].Title.Should().Contain("WI001"); File.Exists(r.EvidencePath!).Should().BeTrue(); } [Fact] public async Task Step22_fails_when_branch_missing_on_worktree() { var ctx = NewCtx("step-22"); ctx.State.Worktrees.Clear(); ctx.State.Worktrees.Add(new WorktreeRecord { Repo = "Glow", MainPath = "m", WorktreePath = "wt", Branch = "" }); var r = await new Step22_CommitPushCreatePullRequest(new StubGitPusher(), new StubPullRequestService()).ExecuteAsync(ctx); r.Verdict.Should().Be(Verdict.Fail); r.FailureCode.Should().Be(FailureCode.PublishFail); } [Fact] public async Task Step22_skips_when_no_worktrees() { var ctx = NewCtx("step-22", withWorktrees: false); var r = await new Step22_CommitPushCreatePullRequest(new StubGitPusher(), new StubPullRequestService()).ExecuteAsync(ctx); r.Message.Should().StartWith("skipped:"); } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |