Skip to content

Refs #159: migrate SQLite.Tests + Memory.Integration.Tests + IntegrationTests.Shared to MSTest (Phase 3 PR B)#173

Merged
blehnen merged 6 commits into
masterfrom
phase-3-transport-trio
Jul 2, 2026
Merged

Refs #159: migrate SQLite.Tests + Memory.Integration.Tests + IntegrationTests.Shared to MSTest (Phase 3 PR B)#173
blehnen merged 6 commits into
masterfrom
phase-3-transport-trio

Conversation

@blehnen

@blehnen blehnen commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Part of #159 (replace FluentAssertions with MSTest assertions). Phase 3, PR B of 2 — the three mechanical/trivial projects.

Projects

  • Transport.SQLite.Tests — 0 .Should() sites; removes a dead using FluentAssertions; + the FluentAssertions PackageReference.
  • Transport.Memory.Integration.Tests — 64 sites across MessageCancellationTests.cs, ConsumerRollBack.cs, DashboardQueries.cs; removes FA ref.
  • DotNetWorkQueue.IntegrationTests.Shared — 3 sites (LoggerShared.cs, JobScheduler/JobSchedulerTestsShared.cs); removes FA ref. This project is ProjectReferenced by 13 integration test projects, all of which own their own FA ref, so removing it here is safe — validated by a full-solution build.

Mapping notes

  • NotBeNullOrEmpty() split by receiver type: string → Assert.IsFalse(string.IsNullOrEmpty(x)); byte[]Assert.IsTrue(x != null && x.Length > 0).
  • bool.Wait(...).Should().BeTrue(reason)Assert.IsTrue(Wait(...), reason); BeGreaterThanOrEqualTo(1)Assert.IsTrue(x >= 1).
  • FA composite-format reason BeEmpty("...{0}", errors)Assert.AreEqual(string.Empty, errors, $"...{errors}") (MSTest has no format-args overload).

Verification

  • Full-solution dotnet build Source/DotNetWorkQueue.sln -c Release0 errors (proves the 13 IntegrationTests.Shared consumers still compile).
  • dotnet test → SQLite.Tests 146/146, Memory.Integration.Tests 57/57.
  • Grep for FluentAssertions/.Should() across all three projects → zero.
  • Source/Directory.Packages.props FA entry intentionally left in place (removed in the final Replace FluentAssertions with MSTest assertions (license: 6.12.2 is last MIT release) #159 phase).

Test-only; no production code change, no version bump.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Standardized test assertions across the suite to use built-in testing checks.
    • Removed an unused test dependency from multiple test projects.
    • Updated one test project to use a different comparison utility for assertions.
    • Kept test coverage and behavior verification intact while simplifying the test setup.

blehnen and others added 6 commits July 2, 2026 09:45
…rom SQLite.Tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…Back.cs to MSTest assertions

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
NotBeNullOrEmpty split by receiver type: string->IsNullOrEmpty, byte[]->length check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tegration.Tests csproj

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…cs to MSTest assertions

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…onTests.Shared csproj

All 13 downstream consumers own their own FA ref; validated by full-solution build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes the FluentAssertions dependency from multiple test projects and converts assertions to MSTest's Assert API across shared integration test helpers, cancellation, consumer rollback, and dashboard query tests. One project swaps FluentAssertions for CompareNETObjects instead.

Changes

FluentAssertions removal and MSTest migration

Layer / File(s) Summary
Shared integration test helpers migrated to MSTest
DotNetWorkQueue.IntegrationTests.Shared.csproj, JobScheduler/JobSchedulerTestsShared.cs, LoggerShared.cs
FluentAssertions package reference and usings removed; null/empty/whitespace assertions converted to Assert.IsNull, Assert.IsFalse, Assert.AreEqual.
Cancellation and consumer rollback tests migrated
Cancellation/MessageCancellationTests.cs, Consumer/ConsumerRollBack.cs
FluentAssertions usings removed; Should().BeTrue/Be assertions replaced with Assert.IsTrue/Assert.AreEqual for wait conditions, counts, and token state checks.
DashboardQueries assertions migrated and Memory project cleanup
Dashboard/DashboardQueries.cs, DotNetWorkQueue.Transport.Memory.Integration.Tests.csproj
All FluentAssertions-based checks across status counts, message counts/listing/detail/body/headers, jobs, delete/command operations converted to MSTest Assert calls; FluentAssertions package reference removed from the project.
SQLite test project dependency swap
Basic/CommandHandler/SetJobLastKnownEventCommandHandlerTests.cs, DotNetWorkQueue.Transport.SQLite.Tests.csproj
FluentAssertions using removed; project package reference replaced with CompareNETObjects.

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

Possibly related issues

Poem

A rabbit hopped through test files wide,
Swept FluentAssertions to the side,
Assert.IsTrue, Assert.AreEqual too,
MSTest checks now shining new! 🐇
Hop, hop, hooray — the tests still pass true!

🚥 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 the listed test projects from FluentAssertions to MSTest.
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 2, 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.Transport.Memory.Integration.Tests/Dashboard/DashboardQueries.cs (1)

360-362: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider splitting combined null/length checks for clearer failure diagnostics.

Assert.IsTrue(body.Body != null && body.Body.Length > 0) collapses two conditions into one; on failure MSTest can't tell you whether it was null or empty. Separate Assert.IsNotNull + length check would give clearer failure messages.

♻️ Proposed refactor
-                Assert.IsNotNull(body);
-                Assert.IsTrue(body.Body != null && body.Body.Length > 0);
-                Assert.IsTrue(body.Headers != null && body.Headers.Length > 0);
+                Assert.IsNotNull(body);
+                Assert.IsNotNull(body.Body);
+                Assert.IsTrue(body.Body.Length > 0);
+                Assert.IsNotNull(body.Headers);
+                Assert.IsTrue(body.Headers.Length > 0);

Also applies to: 388-389

🤖 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.Transport.Memory.Integration.Tests/Dashboard/DashboardQueries.cs`
around lines 360 - 362, The test assertions in DashboardQueries are combining
null and length checks into a single Assert.IsTrue, which hides whether the
failure was caused by a null value or an empty array. Update the checks around
body.Body and body.Headers to use separate Assert.IsNotNull and length
assertions so MSTest reports clearer failures, and apply the same refactor in
both locations mentioned.
🤖 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.Transport.Memory.Integration.Tests/Dashboard/DashboardQueries.cs`:
- Around line 360-362: The test assertions in DashboardQueries are combining
null and length checks into a single Assert.IsTrue, which hides whether the
failure was caused by a null value or an empty array. Update the checks around
body.Body and body.Headers to use separate Assert.IsNotNull and length
assertions so MSTest reports clearer failures, and apply the same refactor in
both locations mentioned.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b9967044-1bda-44ec-b7ab-bb0469b88775

📥 Commits

Reviewing files that changed from the base of the PR and between ef9d7d5 and 5363497.

📒 Files selected for processing (9)
  • Source/DotNetWorkQueue.IntegrationTests.Shared/DotNetWorkQueue.IntegrationTests.Shared.csproj
  • Source/DotNetWorkQueue.IntegrationTests.Shared/JobScheduler/JobSchedulerTestsShared.cs
  • Source/DotNetWorkQueue.IntegrationTests.Shared/LoggerShared.cs
  • Source/DotNetWorkQueue.Transport.Memory.Integration.Tests/Cancellation/MessageCancellationTests.cs
  • Source/DotNetWorkQueue.Transport.Memory.Integration.Tests/Consumer/ConsumerRollBack.cs
  • Source/DotNetWorkQueue.Transport.Memory.Integration.Tests/Dashboard/DashboardQueries.cs
  • Source/DotNetWorkQueue.Transport.Memory.Integration.Tests/DotNetWorkQueue.Transport.Memory.Integration.Tests.csproj
  • Source/DotNetWorkQueue.Transport.SQLite.Tests/Basic/CommandHandler/SetJobLastKnownEventCommandHandlerTests.cs
  • Source/DotNetWorkQueue.Transport.SQLite.Tests/DotNetWorkQueue.Transport.SQLite.Tests.csproj
💤 Files with no reviewable changes (4)
  • Source/DotNetWorkQueue.IntegrationTests.Shared/DotNetWorkQueue.IntegrationTests.Shared.csproj
  • Source/DotNetWorkQueue.Transport.Memory.Integration.Tests/DotNetWorkQueue.Transport.Memory.Integration.Tests.csproj
  • Source/DotNetWorkQueue.Transport.SQLite.Tests/Basic/CommandHandler/SetJobLastKnownEventCommandHandlerTests.cs
  • Source/DotNetWorkQueue.Transport.SQLite.Tests/DotNetWorkQueue.Transport.SQLite.Tests.csproj

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.49%. Comparing base (4c0ad6c) to head (5363497).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #173   +/-   ##
=======================================
  Coverage   87.49%   87.49%           
=======================================
  Files        1023     1023           
  Lines       33863    33863           
  Branches     2864     2864           
=======================================
+ Hits        29627    29628    +1     
- Misses       3359     3362    +3     
+ Partials      877      873    -4     

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

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