Skip to content

Phase 2 (#159): migrate DotNetWorkQueue.Tests to MSTest assertions#171

Merged
blehnen merged 9 commits into
masterfrom
phase-2-core-tests
Jul 1, 2026
Merged

Phase 2 (#159): migrate DotNetWorkQueue.Tests to MSTest assertions#171
blehnen merged 9 commits into
masterfrom
phase-2-core-tests

Conversation

@blehnen

@blehnen blehnen commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Phase 2 of #159 — migrate DotNetWorkQueue.Tests to MSTest assertions

Second increment of #159. Test-only, no production code, no version bump. Migrates the 8 FluentAssertions-using files in the core DotNetWorkQueue.Tests project (76 .Should() sites) to built-in MSTest assertions and removes the project's FA PackageReference. This is the first real migration and establishes the mechanical mapping patterns the remaining phases reuse.

Mapping patterns established

  • .Should().Be(x)Assert.AreEqual(x, actual) (expected-first)
  • .Should().BeSameAs(x)Assert.AreSame(x, actual); BeTrue/FalseAssert.IsTrue/IsFalse; BeNull/NotBeNullAssert.IsNull/IsNotNull
  • .Should().BeOfType<T>()Assert.AreEqual(typeof(T), x.GetType())exact type preserved (not IsInstanceOfType, which would accept subclasses)
  • act.Should().Throw<T>()Assert.Throws<T>(act) (matches T-or-derived, like FA). .NotThrow() → invoke act();. Note: MSTest 4.x removed Assert.ThrowsExceptionAssert.Throws<T> is the replacement.
  • String NotContainAssert.IsFalse(str.Contains(...)); HashSet<T> membership → .Count/.Contains (no CollectionAssert, which doesn't support non-generic-ICollection-less types)

Scope & verification

  • 8 test files migrated + FA PackageReference removed from DotNetWorkQueue.Tests.csproj.
  • Directory.Packages.props left untouched — FluentAssertions stays there until the final-phase cleanup, since other projects still reference it.
  • Release build (-p:CI=true, TreatWarningsAsErrors) clean — proves FA is fully unused.
  • dotnet test905/905 pass, identical to the pre-migration baseline (no test added/removed/renamed).
  • No production assembly changed; no version bump.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated the test suite to use the standard test assertion APIs throughout.
    • Improved consistency in validation, exception, and callback-behavior checks.
    • Removed an unused test assertion dependency from the project.

blehnen and others added 9 commits July 1, 2026 15:18
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t assertions

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

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

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

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

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

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

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df560df9-9641-476c-b31e-41e208115416

📥 Commits

Reviewing files that changed from the base of the PR and between d4813d5 and 4c0ad6c.

📒 Files selected for processing (9)
  • Source/DotNetWorkQueue.Tests/DotNetWorkQueue.Tests.csproj
  • Source/DotNetWorkQueue.Tests/IoC/ContainerWrapperTests.cs
  • Source/DotNetWorkQueue.Tests/JobScheduler/JobScheduleTests.cs
  • Source/DotNetWorkQueue.Tests/Messages/StandardHeadersTests.cs
  • Source/DotNetWorkQueue.Tests/Queue/AddStandardMessageHeadersTests.cs
  • Source/DotNetWorkQueue.Tests/Queue/ConsumerMetricsNotificationTests.cs
  • Source/DotNetWorkQueue.Tests/Queue/ConsumerQueueNotificationTests.cs
  • Source/DotNetWorkQueue.Tests/Queue/MessageCancellationTrackerTests.cs
  • Source/DotNetWorkQueue.Tests/Queue/MessageHandlerCancellationDecoratorTests.cs
💤 Files with no reviewable changes (1)
  • Source/DotNetWorkQueue.Tests/DotNetWorkQueue.Tests.csproj

📝 Walkthrough

Walkthrough

This PR removes the FluentAssertions package reference from the test project and migrates all assertion calls across nine test files to MSTest's native Assert APIs, including boolean, equality, reference, type, and exception assertions.

Changes

FluentAssertions to MSTest Migration

Layer / File(s) Summary
Remove package dependency
Source/DotNetWorkQueue.Tests/DotNetWorkQueue.Tests.csproj
The FluentAssertions PackageReference is removed from the test project.
Container wrapper tests
Source/DotNetWorkQueue.Tests/IoC/ContainerWrapperTests.cs
All disposal, registration, resolution, lifestyle, and suppression assertions rewritten with Assert.IsTrue/IsFalse/AreSame/AreEqual/Throws.
Job scheduler tests
Source/DotNetWorkQueue.Tests/JobScheduler/JobScheduleTests.cs
Cron validation exception assertions switched to Assert.Throws.
Header tests
Source/DotNetWorkQueue.Tests/Messages/StandardHeadersTests.cs, Source/DotNetWorkQueue.Tests/Queue/AddStandardMessageHeadersTests.cs
Header presence, value, and content checks rewritten with Assert.AreEqual/IsNull/IsTrue/IsFalse.
Consumer notification tests
Source/DotNetWorkQueue.Tests/Queue/ConsumerMetricsNotificationTests.cs, Source/DotNetWorkQueue.Tests/Queue/ConsumerQueueNotificationTests.cs
Delegate invocation counts, callback flags, and null-argument exceptions rewritten with Assert.AreEqual/IsTrue/Throws.
Cancellation tracker and decorator tests
Source/DotNetWorkQueue.Tests/Queue/MessageCancellationTrackerTests.cs, Source/DotNetWorkQueue.Tests/Queue/MessageHandlerCancellationDecoratorTests.cs
Token cancellation state, processing status, null/type checks, and exceptions rewritten with MSTest Assert equivalents.

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

Possibly related issues

Poem

A rabbit hops through lines of test,
Swapping "Should" for MSTest's best 🐇
No more fluent chains to trace,
Just Assert.IsTrue in its place.
Hop, hop, clean — the suite compiles fast!

🚥 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 DotNetWorkQueue.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 1, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #171      +/-   ##
==========================================
- Coverage   87.54%   87.49%   -0.06%     
==========================================
  Files        1023     1023              
  Lines       33863    33863              
  Branches     2864     2864              
==========================================
- Hits        29645    29627      -18     
- Misses       3345     3359      +14     
- Partials      873      877       +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.

@blehnen blehnen merged commit ef9d7d5 into master Jul 1, 2026
6 checks passed
@blehnen blehnen deleted the phase-2-core-tests branch July 1, 2026 22:11
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