in-async/TestAA

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

Opened this issue · 0 comments

改善案のイメージ:

// 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