You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allows to assert some derived exceptions are thrown.
Background and Motivation
Assert.ThrowsException<T> and Assert.ThrowsExceptionAsync<T> are checking that the exception throws is exactly matching the one specified as generic type argument. It can often happen that you would instead prefer to say type or derived types.
Proposed Feature
Add Assert.ThrowsAnyException<T>/Assert.ThrowsAnyExceptionAsync<T> or add overloads of the current APIs with a boolean allowing to control whether to check exact type or derived.
Alternative Designs
Relax current APIs and introduce Assert.ThrowsExactException<T> and Assert.ThrowsExactExceptionAsync. Although I prefer the naming, this would introduce a potentially strong functional breaking change for users so I would be reluctant to do it.
The text was updated successfully, but these errors were encountered:
Summary
Allows to assert some derived exceptions are thrown.
Background and Motivation
Assert.ThrowsException<T>
andAssert.ThrowsExceptionAsync<T>
are checking that the exception throws is exactly matching the one specified as generic type argument. It can often happen that you would instead prefer to say type or derived types.Proposed Feature
Add
Assert.ThrowsAnyException<T>
/Assert.ThrowsAnyExceptionAsync<T>
or add overloads of the current APIs with a boolean allowing to control whether to check exact type or derived.Alternative Designs
Relax current APIs and introduce
Assert.ThrowsExactException<T>
andAssert.ThrowsExactExceptionAsync
. Although I prefer the naming, this would introduce a potentially strong functional breaking change for users so I would be reluctant to do it.The text was updated successfully, but these errors were encountered: