Skip to content

Assert 時に期待した例外 (expectedException) が無かった場合のアサートエラーが判り難い #17

Description

@in-async

改善案のイメージ:

// Act
TestActual<T> actual = TestAA.Act(() => ...);

// Assert - Exception
if (expectedException is { }) {
    if (actual.Exception is { } ex) {
        if (ex.GetType() == expectedException) { return; }
        throw ex;
    }
    else {
        throw new PrimitiveAssertFailedException("期待した例外が生じませんでした: " + expectedException.FullName);
    }
}

// Assert - Return

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions