Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
in-async opened this issue Feb 10, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@in-async
Copy link
Owner

改善案のイメージ:

// 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
@in-async in-async added the bug Something isn't working label Feb 10, 2021
@in-async in-async self-assigned this Feb 10, 2021
@in-async in-async changed the title Assert 時に期待した例外 (expectedException) が生じなかった場合のアサートエラーが判り難い Assert 時に期待した例外 (expectedException) が無かった場合のアサートエラーが判り難い Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant