Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Unit tests incorrectly using ThrowsAsync<> #7

@fig-nwebb

Description

@fig-nwebb

Many of the unit tests are using ThrowsAsync<> incorrectly, in the form of:

[Fact]
public void TestTheThing()
{
    proxyClient = new();
    _ = Assert.ThrowsAsync<ArgumentExpection>(async () => /* do something with the client */);
}

Unfortunately, failing to await the call to Assert.ThrowsAsync will cause the test harness to only check that something deriving from Exception came back, not the actual specified type. Relevant GH issue.

In addition to the above, fixing these tests will result in additional breaks, in some cases. Assert.ThrowsAsync will look for the exact type that was specified. If the test is looking for ArgumentExpection but the logic under test throws ArgumentNullException, the test will fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions