Refs #159: migrate Dashboard.Api.Integration.Tests to MSTest assertions (Phase 6)#176
Conversation
…assertions Replace all 838 FluentAssertions .Should() sites across 52 files with MSTest assertions. Non-1:1 patterns mapped to Tests.Shared AssertHelper: BeCloseTo->AreClose (3), AllSatisfy->AllSatisfy (6). NotBeEmpty on Guid subjects (ConsumerId, queueId1/2, queues[].Id)->AreNotEqual(Guid.Empty). NotBeNullOrEmpty on List subjects (connections/queues)->IsNotNull + Count>0. Add Tests.Shared ProjectReference; remove FluentAssertions PackageReference. Directory.Packages.props untouched (Phase 8). Refs #159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR removes the FluentAssertions dependency from the Dashboard.Api.Integration.Tests project, adding a ProjectReference to DotNetWorkQueue.Tests.Shared, and rewrites all test assertions across every transport (Memory, LiteDb, PostgreSql, Redis, SqlServer, Sqlite) and cross-cutting test files to use MSTest's Assert/StringAssert APIs and a shared AssertHelper. ChangesFluentAssertions to MSTest Migration
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteMaintenanceTests.cs (1)
120-121: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueArgument order swapped vs. shared helper signature, but harmless.
AssertHelper.AreClose(expected, actual, tolerance)is called asAreClose(DateTime.UtcNow, polled.LastRunUtc.Value, ...), i.e.,expected/actualare reversed relative to the helper's parameter names. Since the helper computes an absolute delta, behavior is unaffected, but the failure message will report values with swapped semantics (e.g., "Expected {LastRunUtc} to be within X of {UtcNow}").🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteMaintenanceTests.cs` around lines 120 - 121, The call to AssertHelper.AreClose in SqliteMaintenanceTests uses reversed expected/actual argument order, which only affects the failure message. Update the assertion near polled.LastRunUtc so the current time is passed as the expected value and the polled timestamp as the actual value, matching the AssertHelper.AreClose(expected, actual, tolerance) signature and keeping diagnostics consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteMaintenanceTests.cs`:
- Around line 120-121: The call to AssertHelper.AreClose in
SqliteMaintenanceTests uses reversed expected/actual argument order, which only
affects the failure message. Update the assertion near polled.LastRunUtc so the
current time is passed as the expected value and the polled timestamp as the
actual value, matching the AssertHelper.AreClose(expected, actual, tolerance)
signature and keeping diagnostics consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf6c4bf9-585a-4edb-ad98-f741c005076a
📒 Files selected for processing (53)
Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/DotNetWorkQueue.Dashboard.Api.Integration.Tests.csprojSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/AssemblyPathTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/AuthorizationPolicyIntegrationTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/ConsumersEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/CorsIntegrationTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/DashboardStartupTimingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/EdgeCaseTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/EmptyQueueTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/HealthEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbErrorTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbHistoryTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbProcessingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbStaleTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MemoryEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MemoryHistoryTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MemoryStatefulTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MultiQueueTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MultiSourcePartialFailureTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MultiSourceTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlEditBodyTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlErrorTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlHistoryEnabledTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlHistoryTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlProcessingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlStaleTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisErrorTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisHistoryTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisProcessingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisStaleTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerEditBodyTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerErrorTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerHistoryEnabledTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerHistoryTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerProcessingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerStaleTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteBulkOperationsTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteConsumerTrackingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteEditBodyTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteEndpointTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteErrorPathTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteErrorTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteHistoryEnabledTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteHistoryTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteMaintenanceTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteProcessingTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteQueueConfigTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteSettingsAndReadOnlyTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteStaleTests.csSource/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SwaggerEndpointTests.cs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #176 +/- ##
==========================================
- Coverage 87.44% 87.32% -0.12%
==========================================
Files 1024 1024
Lines 33905 33905
Branches 2870 2870
==========================================
- Hits 29647 29609 -38
- Misses 3383 3407 +24
- Partials 875 889 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



Migrates
DotNetWorkQueue.Dashboard.Api.Integration.Testsoff FluentAssertions to built-in MSTest assertions. Part of #159 (remove the MIT-pinned FluentAssertions 6.12.2). Test-only — no production assemblies, no version bump.Scope
.Should()sites underTests/migrated toAssert.*/StringAssert.*/AssertHelper.*.DotNetWorkQueue.Tests.SharedProjectReference; removed the FluentAssertionsPackageReference.Source/Directory.Packages.propsuntouched (the package line is removed in the final cleanup phase).Non-1:1 mappings (verified against actual types)
BeCloseTo(3) →AssertHelper.AreClose(DateTimeOffset/DateTimeoverloads).AllSatisfy(6) →AssertHelper.AllSatisfy.NotBeEmptyonGuidsubjects (ConsumerId,queueId1/2,queues[].Id) →Assert.AreNotEqual(Guid.Empty, …).NotBeNullOrEmptyonList<>subjects (connections,queues) →Assert.IsNotNull+Count > 0; string subjects →Assert.IsFalse(string.IsNullOrEmpty(…)).Containon the CORSoriginscollection →Assert.IsTrue(origins.Contains(…)).Verification
net10.0+net8.0,TreatWarningsAsErrors): 0 warnings / 0 errors — any leftover FA symbol or wrong type mapping would be a compile error.FluentAssertions/using FluentAssertions/.Should().🤖 Generated with Claude Code
Summary by CodeRabbit