Skip to content

Refs #159: migrate Dashboard.Client.Tests + Dashboard.Ui.Tests to MSTest assertions (Phase 4)#174

Merged
blehnen merged 2 commits into
masterfrom
phase-4-dashboard-tests
Jul 3, 2026
Merged

Refs #159: migrate Dashboard.Client.Tests + Dashboard.Ui.Tests to MSTest assertions (Phase 4)#174
blehnen merged 2 commits into
masterfrom
phase-4-dashboard-tests

Conversation

@blehnen

@blehnen blehnen commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Part of #159 (replace FluentAssertions with MSTest assertions). Phase 4 — the two Dashboard unit-test projects, in one combined PR (single Jenkins build).

Migrates 304 .Should() sites across 13 files to built-in MSTest assertions and removes each project's FluentAssertions PackageReference. No Tests.Shared helper needed (no BeEquivalentTo/BeCloseTo/AllSatisfy).

Projects

  • Dashboard.Client.Tests — 3 files, 215 sites (ModelTests, DashboardApiClientTests, DashboardConsumerClientTests).
  • Dashboard.Ui.Tests — 10 files, 89 sites (bUnit/MudBlazor component tests + Services).

Mapping notes

  • Be/BeTrue/BeFalse/BeNull/NotBeNull/HaveCountAssert.AreEqual/IsTrue/IsFalse/IsNull/IsNotNull/AreEqual(n, x.Count) (expected-first).
  • Throw<T>()Assert.Throws<T>(act); ThrowAsync<T>await Assert.ThrowsAsync<T>(act); NotThrow/NotThrowAsync → bare act()/await act().
  • Throw<T>().WithMessage("*X*")var ex = Assert.Throws<T>(act); StringAssert.Contains(ex.Message, "X", StringComparison.OrdinalIgnoreCase)OrdinalIgnoreCase preserves FA WithMessage's case-insensitive matching.
  • String Contain/EndWithStringAssert.Contains/EndsWith (case-sensitive, matching FA Contain); NotContainAssert.IsFalse(x.Contains(..)).
  • ContainKeyContainsKey; collection BeEmpty/NotBeEmptyAssert.IsFalse/IsTrue(x.Any()); BeAssignableTo<T>Assert.IsInstanceOfType(x, typeof(T)); BeSameAs/NotBeSameAsAssert.AreSame/AreNotSame; BeOnOrAfterAssert.IsTrue(x >= y).

Verification

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Updated dashboard client and UI tests to use MSTest assertions instead of FluentAssertions.
    • Kept test coverage and expected behaviors the same while modernizing assertion style.
    • Improved some checks for markup, navigation, collections, and exception messages.
  • Chores

    • Removed the FluentAssertions dependency from test projects.
    • Adjusted test project references to match the updated assertion approach.

blehnen and others added 2 commits July 2, 2026 15:12
3 files / 215 sites; remove FluentAssertions PackageReference. Throw<T>/ThrowAsync,
ContainKey, HaveCount, StringAssert.Contains mappings. 92/92 tests green (net10+net8).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
10 files / 89 sites; remove FluentAssertions PackageReference. Throw().WithMessage
chains -> capture ex + StringAssert.Contains(OrdinalIgnoreCase, matching FA's
case-insensitive WithMessage); BeAssignableTo->IsInstanceOfType; BeSameAs/NotBeSameAs
->AreSame/AreNotSame; collection BeEmpty/NotBeEmpty->Assert.IsFalse/IsTrue(x.Any());
StringAssert.Contains/EndsWith for string Contain/EndWith. 66/66 tests green (net10+net8).

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

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: 5661b194-bcd1-485f-9377-dc7fdd09452c

📥 Commits

Reviewing files that changed from the base of the PR and between 4abb8a0 and 73e2a50.

📒 Files selected for processing (15)
  • Source/DotNetWorkQueue.Dashboard.Client.Tests/DashboardApiClientTests.cs
  • Source/DotNetWorkQueue.Dashboard.Client.Tests/DashboardConsumerClientTests.cs
  • Source/DotNetWorkQueue.Dashboard.Client.Tests/DotNetWorkQueue.Dashboard.Client.Tests.csproj
  • Source/DotNetWorkQueue.Dashboard.Client.Tests/ModelTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Components/Layout/MainLayoutTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Components/Pages/HomeTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Components/Pages/LoginTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Components/Shared/HistoryTabTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/DotNetWorkQueue.Dashboard.Ui.Tests.csproj
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/ConfigValidationTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/DashboardApiSourceConfigTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/LocalSourceHostedServiceTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/MultiSourceDashboardApiClientTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/SourceHealthMonitorTests.cs
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/SourceRegistryTests.cs
💤 Files with no reviewable changes (2)
  • Source/DotNetWorkQueue.Dashboard.Client.Tests/DotNetWorkQueue.Dashboard.Client.Tests.csproj
  • Source/DotNetWorkQueue.Dashboard.Ui.Tests/DotNetWorkQueue.Dashboard.Ui.Tests.csproj

📝 Walkthrough

Walkthrough

This PR migrates test assertion logic across two test projects (Dashboard.Client.Tests and Dashboard.Ui.Tests) from FluentAssertions to MSTest-native Assert/StringAssert APIs, and removes the FluentAssertions package reference from both project files. No production code or public API signatures change.

Changes

FluentAssertions to MSTest test migration

Layer / File(s) Summary
API client test assertions
Source/DotNetWorkQueue.Dashboard.Client.Tests/DashboardApiClientTests.cs
Constructor validation and all API method success/failure assertions converted to Assert.IsTrue/IsFalse/AreEqual/IsNull, Assert.Throws<>, and StringAssert.Contains.
Consumer client test assertions
Source/DotNetWorkQueue.Dashboard.Client.Tests/DashboardConsumerClientTests.cs
Registration, metrics, heartbeat, dispose, and exception-throwing tests converted to MSTest Assert/Assert.Throws/Assert.ThrowsAsync.
Model tests and client project deps
Source/DotNetWorkQueue.Dashboard.Client.Tests/ModelTests.cs, .../DotNetWorkQueue.Dashboard.Client.Tests.csproj
Response-model property assertions rewritten to Assert.AreEqual/IsTrue/IsFalse; FluentAssertions package reference removed.
UI component test assertions
Source/DotNetWorkQueue.Dashboard.Ui.Tests/Components/{Layout,Pages,Shared}/*.cs, .../DotNetWorkQueue.Dashboard.Ui.Tests.csproj
Markup and navigation checks in layout, home, login, and history-tab tests converted to StringAssert.Contains/EndsWith and Assert.IsFalse/AreEqual; FluentAssertions removed, AutoFixture/bunit package references added.
UI services test assertions
Source/DotNetWorkQueue.Dashboard.Ui.Tests/Services/*.cs
Config validation, source config, hosted service, multi-source client, health monitor, and registry tests converted from FluentAssertions to Assert/StringAssert/Assert.Throws equivalents.

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

Possibly related issues

Poem

A rabbit hopped through lines of test,
Swapped "Should().Be" for MSTest's best,
No more fluent chains to trace,
Just Assert.AreEqual in its place. 🐇
Clean and lean, the suite now runs,
Twitchy nose approves — the migration's done!

🚥 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 accurately summarizes the main change: migrating both test projects 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 2, 2026

Copy link
Copy Markdown

@blehnen blehnen merged commit 8f5acc7 into master Jul 3, 2026
4 of 5 checks passed
@blehnen blehnen deleted the phase-4-dashboard-tests branch July 3, 2026 02:20
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