Skip to content

Convert the remaining native xUnit assertions to AwesomeAssertions #941

Description

@ptr727

Why

The .github/skills tree carried from the hub in #940 brings dotnet-codestyle/references/testing.md, which states:

Native xUnit asserts (Assert.Equal, Assert.True, ...) are not allowed, use the fluent .Should() API.

Most of the suite already follows it. Four files do not, and they predate the convention arriving here, so this is a conformance gap the carry surfaced rather than anything #940 changed. All four are line-endings-only in that pull request.

What

53 native assertions remain:

File Count
PlexCleanerTests/ConfigFileTests.cs 23
PlexCleanerTests/SidecarFileTests.cs 19
PlexCleanerTests/VersionParsingTests.cs 10
PlexCleanerTests/WildcardTests.cs 1

By form: Assert.Equal 27, Assert.True 12, Assert.Contains 7, Assert.NotNull 6, Assert.Empty 1.

Assert.Skip and Assert.SkipWhen stay native per the same reference, since dynamic skipping is control flow rather than an assertion. The suite currently uses neither.

Notes

Raised by Copilot against #940 as a body-only finding ("At least one updated test still uses native xUnit assertions despite the newly carried .NET testing convention requiring AwesomeAssertions"). Deferred out of that pull request rather than folded in: the rewrite touches four files and none of the resync's own subject matter, and #940 was already green and fully reviewed at the time.

AwesomeAssertions is already referenced by the test project, so this needs no dependency change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions