Skip to content

test: replace FluentAssertions with NUnit assertions - #28

Merged
rsubrama83 merged 1 commit into
mainfrom
test/replace-fluentassertions
Oct 2, 2026
Merged

rsubrama83 merged 1 commit into
mainfrom
test/replace-fluentassertions

Conversation

@rsubrama83

Copy link
Copy Markdown
Collaborator

Summary

Closes #15. Removes FluentAssertions and uses NUnit's Assert.That throughout, matching the rest of the test suite.

FluentAssertions was only used in 6 places, so this is a small change:

Location Before After
FontStyleSetTests .Should().BeTrue() / BeFalse() Is.True / Is.False
DynamicImageTests BeEquivalentTo(new Size(...)) Is.EqualTo (Size is a readonly struct)
TestPlan measure BeEquivalentTo(expectedMeasure) Is.EqualTo (SpacePlan is a readonly struct)
TestPlan draw ops BeEquivalentTo(..., PreferringRuntimeMemberTypes) Is.EqualTo on the operation list
TextStyleTests BeEquivalentTo(..., IncludingNestedObjects, ...) Is.EqualTo (TextStyle is a record, Fallback compared recursively)
GridTests unused using removed

OperationBase and its 9 subclasses (test engine only) are now records, which gives them value equality. Record equality also checks the runtime type, so it's slightly stricter than BeEquivalentTo.

Failure messages

  • Operations: the record ToString() prints every property, for example
    Expected: <CanvasTranslateOperation { Position = (Left: 1,000, Top: 0,000) }> But was: <... (Left: 0,000 ...)>
  • TextStyle: its members are internal, so the record ToString() prints TextStyle { }. The test now passes a message that lists all members of both styles.

Verification

  • All tests pass: 150/150 unit tests, 130/130 example tests (forced rebuild)
  • Mutation checks, both caught by the new assertions:
    • shifting every expected CanvasTranslateOperation by 1px fails the alignment tests
    • changing the expected Fallback.HasUnderline fails ApplyInheritedAndGlobalStyle

test: commit, so merging does not trigger a release.

🤖 Generated with Claude Code

FluentAssertions was used in only six places. Use NUnit's Assert.That
like the rest of the test suite and drop the dependency.

The deep BeEquivalentTo comparisons now rely on value equality: Size,
SpacePlan and Position are readonly structs, TextStyle is a record, and
the test engine operations are turned into records. Since TextStyle
members are internal, its test describes both styles in the failure
message.

Closes #15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rsubrama83
rsubrama83 merged commit a0a5490 into main Oct 2, 2026
1 check passed
@rsubrama83
rsubrama83 deleted the test/replace-fluentassertions branch October 2, 2026 11:39
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.

Replace Xceed Fluent Assertions

2 participants