test(Web.Tests): migrate to xUnit v3 — headers, AAA, indentation (#190) - #192
Conversation
- Aragorn gate: ✅ OPEN (xUnit v3 pattern proven via Sprint 7–8 pilots) - Gimli plan: Issue #190, 127 tests across 3 phases (package → API → verify) - Pippin docs: Session log created (not committed per .gitignore) - Inbox: No new decisions this round Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ix indentation - Upgrade xunit → xunit.v3 in Web.Tests.csproj - Remove coverlet.msbuild (not used with v3); keep coverlet.collector - Add xunit.runner.json with parallelism settings matching Domain.Tests - Fix file headers: 'Unit.Tests' → 'Web.Tests' across all affected files - Remove duplicate old-format header from ResultTests.cs - Add AAA pattern (// Arrange, // Act, // Assert) to all test methods lacking them - Fix indentation in 4 handler test files (entire class body was at col 0) - All 127 tests pass Closes #190 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
|
✅ Comprehensive Review Complete — Ready to Merge ✅ Configuration & Setup
✅ Code QualityFile Headers: All 13 test files correctly show 'Project Name: Web.Tests'
AAA Pattern: 217 Arrange/Act/Assert comments added consistently
Indentation: All 4 handler test files checked and aligned correctly ✅ Test Execution
✅ Scope & Quality
Verdict: Ready for merge. Gimli's work successfully completes Sprint 9 Web.Tests xUnit v3 migration. |
Test Results Summary273 tests ±0 273 ✅ ±0 15s ⏱️ ±0s Results for commit b5e6c96. ± Comparison against base commit f47fc70. This pull request removes 127 and adds 127 tests. Note that renamed tests count towards both. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #192 +/- ##
=======================================
Coverage 78.64% 78.64%
=======================================
Files 43 43
Lines 721 721
Branches 112 112
=======================================
Hits 567 567
Misses 108 108
Partials 46 46 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Completes the tests/Web.Tests migration to xUnit v3 and aligns the project with established repository testing conventions (runner config, package refs), while also standardizing test readability via headers, AAA comments, and indentation cleanups.
Changes:
- Migrated
Web.Testsfrom xUnit v2 to xUnit v3 and addedxunit.runner.jsonparallelism configuration. - Updated test file headers and added Arrange/Act/Assert comments across many tests.
- Reformatted several handler test files to correct indentation issues.
Reviewed changes
Copilot reviewed 14 out of 18 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Web.Tests/xunit.runner.json | Adds xUnit runner configuration (schema, display options, parallelism). |
| tests/Web.Tests/Web.Tests.csproj | Switches to xunit.v3, removes coverlet.msbuild, includes runner json in output. |
| tests/Web.Tests/Security/RoleClaimsHelperTests.cs | Updates header project name to Web.Tests. |
| tests/Web.Tests/ResultTests.cs | Updates header project name, removes duplicate legacy header block, adds AAA comments. |
| tests/Web.Tests/Handlers/UserManagementHandlerTests.cs | Updates header and adds AAA comments for tests. |
| tests/Web.Tests/Handlers/GetBlogPostsHandlerTests.cs | Applies indentation fixes and preserves AAA structure. |
| tests/Web.Tests/Handlers/EditBlogPostHandlerTests.cs | Applies indentation fixes and AAA structure in tests. |
| tests/Web.Tests/Handlers/DeleteBlogPostHandlerTests.cs | Applies indentation fixes and AAA comments. |
| tests/Web.Tests/Handlers/CreateBlogPostHandlerTests.cs | Applies indentation fixes and AAA comments. |
| tests/Web.Tests/Features/BlogPosts/Commands/EditBlogPostCommandValidatorTests.cs | Updates header and adds AAA comments for validator tests. |
| tests/Web.Tests/Features/BlogPosts/Commands/DeleteBlogPostCommandValidatorTests.cs | Updates header and adds AAA comments for validator tests. |
| tests/Web.Tests/Features/BlogPosts/Commands/CreateBlogPostCommandValidatorTests.cs | Updates header and adds AAA comments for validator tests. |
| tests/Web.Tests/Data/BlogPostMappingsTests.cs | Updates header project name to Web.Tests. |
| tests/Web.Tests/BlogPostTests.cs | Updates header project name and adds AAA comments. |
| tests/Web.Tests/Behaviors/ValidationBehaviorTests.cs | Updates header project name and adds AAA comments. |
| .squad/agents/pippin/history.md | Records Sprint 9 kickoff documentation notes. |
| .squad/agents/gimli/history.md | Records Sprint 9 Web.Tests xUnit v3 migration completion details. |
| .squad/agents/aragorn/history.md | Records Sprint 9 readiness gate entry for Web.Tests migration. |
| //Project Name : Web.Tests | ||
| //======================================================= | ||
|
|
||
| using System.Net; |
| //Project Name : Web.Tests | ||
| //======================================================= | ||
|
|
||
| namespace Unit.Data; |
| //Project Name : Web.Tests | ||
| //======================================================= |
| // Arrange | ||
| var command = new CreateBlogPostCommand("Title", "Content", "Author"); | ||
| _repo.AddAsync(Arg.Any<BlogPost>(), Arg.Any<CancellationToken>()) | ||
| .ThrowsAsync(new InvalidOperationException("insert failed")); |
| // Arrange (none) | ||
|
|
||
| // Act | ||
| var result = await _handler.Handle(new GetUsersWithRolesQuery(), CancellationToken.None); | ||
|
|
| new(Guid.NewGuid(), "T1", "C1", "A1", DateTime.UtcNow, null, false), | ||
| new(Guid.NewGuid(), "T2", "C2", "A2", DateTime.UtcNow, null, true), |
| _cache.GetOrFetchAllAsync( | ||
| Arg.Any<Func<Task<IReadOnlyList<BlogPostDto>>>>(), | ||
| Arg.Any<CancellationToken>()) | ||
| .Returns(new ValueTask<IReadOnlyList<BlogPostDto>>(cachedList)); |
| _cache.GetOrFetchByIdAsync( | ||
| Arg.Any<Guid>(), | ||
| Arg.Any<Func<Task<BlogPostDto?>>>(), | ||
| Arg.Any<CancellationToken>()) | ||
| .Returns(new ValueTask<BlogPostDto?>(dto)); |
| var command = new DeleteBlogPostCommand(id); | ||
| _repo.DeleteAsync(id, Arg.Any<CancellationToken>()) | ||
| .ThrowsAsync(new InvalidOperationException("delete failed")); | ||
|
|
Completes Sprint 9 Web.Tests xUnit v3 migration.
Changes
Test Results
References