Skip to content

Refs #159: migrate Dashboard.Api.Integration.Tests to MSTest assertions (Phase 6)#176

Merged
blehnen merged 1 commit into
masterfrom
phase-6-dashboard-api-integration-tests
Jul 4, 2026
Merged

Refs #159: migrate Dashboard.Api.Integration.Tests to MSTest assertions (Phase 6)#176
blehnen merged 1 commit into
masterfrom
phase-6-dashboard-api-integration-tests

Conversation

@blehnen

@blehnen blehnen commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Migrates DotNetWorkQueue.Dashboard.Api.Integration.Tests off 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

  • 52 files / 838 .Should() sites under Tests/ migrated to Assert.* / StringAssert.* / AssertHelper.*.
  • Added DotNetWorkQueue.Tests.Shared ProjectReference; removed the FluentAssertions PackageReference.
  • Source/Directory.Packages.props untouched (the package line is removed in the final cleanup phase).

Non-1:1 mappings (verified against actual types)

  • BeCloseTo (3) → AssertHelper.AreClose (DateTimeOffset/DateTime overloads).
  • AllSatisfy (6) → AssertHelper.AllSatisfy.
  • NotBeEmpty on Guid subjects (ConsumerId, queueId1/2, queues[].Id) → Assert.AreNotEqual(Guid.Empty, …).
  • NotBeNullOrEmpty on List<> subjects (connections, queues) → Assert.IsNotNull + Count > 0; string subjects → Assert.IsFalse(string.IsNullOrEmpty(…)).
  • Contain on the CORS origins collection → Assert.IsTrue(origins.Contains(…)).

Verification

  • Release build (both net10.0 + net8.0, TreatWarningsAsErrors): 0 warnings / 0 errors — any leftover FA symbol or wrong type mapping would be a compile error.
  • Project-wide grep: 0 FluentAssertions / using FluentAssertions / .Should().
  • Local runtime gate (Memory + SQLite + LiteDb subset): 219/219 passed on net8.0 and net10.0.
  • SQL Server / PostgreSQL / Redis suites validate on Jenkins (external services).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated the integration test suite to use built-in MSTest assertions instead of a third-party assertion library.
    • Improved consistency across dashboard, queue, history, error, processing, and configuration test coverage.
    • Added shared test helpers for repeated validation patterns in a few scenarios.

…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>
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This 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.

Changes

FluentAssertions to MSTest Migration

Layer / File(s) Summary
Project dependency changes
Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/DotNetWorkQueue.Dashboard.Api.Integration.Tests.csproj
Removes the FluentAssertions package reference and adds a ProjectReference to DotNetWorkQueue.Tests.Shared.
Core/misc endpoint, auth, CORS, health, swagger, multi-source/multi-queue tests
Tests/AssemblyPathTests.cs, Tests/AuthorizationPolicyIntegrationTests.cs, Tests/ConsumersEndpointTests.cs, Tests/CorsIntegrationTests.cs, Tests/DashboardStartupTimingTests.cs, Tests/EdgeCaseTests.cs, Tests/EmptyQueueTests.cs, Tests/HealthEndpointTests.cs, Tests/SwaggerEndpointTests.cs, Tests/MultiQueueTests.cs, Tests/MultiSourceTests.cs, Tests/MultiSourcePartialFailureTests.cs
Removes FluentAssertions usings and rewrites assertions with MSTest Assert/StringAssert and AssertHelper across authorization, CORS, health, swagger, consumer, and multi-source/queue scenarios.
LiteDb transport tests
Tests/LiteDbEndpointTests.cs, Tests/LiteDbErrorTests.cs, Tests/LiteDbHistoryTests.cs, Tests/LiteDbProcessingTests.cs, Tests/LiteDbStaleTests.cs
Converts all LiteDb dashboard endpoint, error, history, processing, and stale-message assertions from FluentAssertions to MSTest.
Memory transport tests
Tests/MemoryEndpointTests.cs, Tests/MemoryHistoryTests.cs, Tests/MemoryStatefulTests.cs
Converts Memory transport endpoint, history, and stateful/processing assertions from FluentAssertions to MSTest.
PostgreSql transport tests
Tests/PostgreSqlEditBodyTests.cs, Tests/PostgreSqlEndpointTests.cs, Tests/PostgreSqlErrorTests.cs, Tests/PostgreSqlHistoryEnabledTests.cs, Tests/PostgreSqlHistoryTests.cs, Tests/PostgreSqlProcessingTests.cs, Tests/PostgreSqlStaleTests.cs
Converts PostgreSql endpoint, edit-body, error, history, processing, and stale-message assertions from FluentAssertions to MSTest.
Redis transport tests
Tests/RedisEndpointTests.cs, Tests/RedisErrorTests.cs, Tests/RedisHistoryTests.cs, Tests/RedisProcessingTests.cs, Tests/RedisStaleTests.cs
Converts Redis endpoint, error, history, processing, and stale-message assertions from FluentAssertions to MSTest.
SqlServer transport tests
Tests/SqlServerEditBodyTests.cs, Tests/SqlServerEndpointTests.cs, Tests/SqlServerErrorTests.cs, Tests/SqlServerHistoryEnabledTests.cs, Tests/SqlServerHistoryTests.cs, Tests/SqlServerProcessingTests.cs, Tests/SqlServerStaleTests.cs
Converts SqlServer endpoint, edit-body, error, history, processing, and stale-message assertions from FluentAssertions to MSTest.
Sqlite transport, consumer tracking, maintenance, and settings tests
Tests/SqliteBulkOperationsTests.cs, Tests/SqliteConsumerTrackingTests.cs, Tests/SqliteEditBodyTests.cs, Tests/SqliteEndpointTests.cs, Tests/SqliteErrorPathTests.cs, Tests/SqliteErrorTests.cs, Tests/SqliteHistoryEnabledTests.cs, Tests/SqliteHistoryTests.cs, Tests/SqliteMaintenanceTests.cs, Tests/SqliteProcessingTests.cs, Tests/SqliteQueueConfigTests.cs, Tests/SqliteSettingsAndReadOnlyTests.cs, Tests/SqliteStaleTests.cs
Converts Sqlite bulk operations, consumer tracking, edit-body, endpoint, error-path, history, maintenance, processing, queue config, and read-only/settings assertions from FluentAssertions to MSTest.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

Possibly related PRs

  • blehnen/DotNetWorkQueue#170: Introduces the shared AssertHelper (e.g., AssertHelper.AllSatisfy, AssertHelper.AreClose) that this PR consumes via the new DotNetWorkQueue.Tests.Shared project reference.
  • blehnen/DotNetWorkQueue#173: Performs the same FluentAssertions-to-MSTest migration pattern in a different test project (IntegrationTests.Shared/Memory/SQLite tests).

Poem

A rabbit hopped through lines of test,
Swapping "Should()" for "Assert" as best,
No more fluent chains to trace,
MSTest hops into its place. 🐇
Green checks bloom across the queue's domain!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrating Dashboard.Api.Integration.Tests to MSTest assertions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteMaintenanceTests.cs (1)

120-121: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Argument order swapped vs. shared helper signature, but harmless.

AssertHelper.AreClose(expected, actual, tolerance) is called as AreClose(DateTime.UtcNow, polled.LastRunUtc.Value, ...), i.e., expected/actual are 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

📥 Commits

Reviewing files that changed from the base of the PR and between 47cb82c and 06adc91.

📒 Files selected for processing (53)
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/DotNetWorkQueue.Dashboard.Api.Integration.Tests.csproj
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/AssemblyPathTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/AuthorizationPolicyIntegrationTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/ConsumersEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/CorsIntegrationTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/DashboardStartupTimingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/EdgeCaseTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/EmptyQueueTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/HealthEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbErrorTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbHistoryTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbProcessingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/LiteDbStaleTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MemoryEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MemoryHistoryTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MemoryStatefulTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MultiQueueTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MultiSourcePartialFailureTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/MultiSourceTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlEditBodyTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlErrorTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlHistoryEnabledTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlHistoryTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlProcessingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/PostgreSqlStaleTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisErrorTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisHistoryTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisProcessingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/RedisStaleTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerEditBodyTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerErrorTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerHistoryEnabledTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerHistoryTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerProcessingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqlServerStaleTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteBulkOperationsTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteConsumerTrackingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteEditBodyTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteEndpointTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteErrorPathTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteErrorTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteHistoryEnabledTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteHistoryTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteMaintenanceTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteProcessingTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteQueueConfigTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteSettingsAndReadOnlyTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SqliteStaleTests.cs
  • Source/DotNetWorkQueue.Dashboard.Api.Integration.Tests/Tests/SwaggerEndpointTests.cs

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.32%. Comparing base (f279ff5) to head (06adc91).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blehnen blehnen merged commit f0dc20f into master Jul 4, 2026
6 checks passed
@blehnen blehnen deleted the phase-6-dashboard-api-integration-tests branch July 4, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant