-
XUnit ThrowsAsync<> doesn't seem to be checking the exception type. I am trying to check the type of the exception thrown in my unit test. However, XUnit does not seem to be not checking the exception type but only that its an Exception. Surely the below test should fail as the exception thrown is of type NotImplementedException but the test was expecting ArgumentException. It passes as long as any kind of exception is thrown.
Is this a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I believe it's working as one might expect; I get:
(the impl looks correct internally too, which is no surprise - lots of people use it and would have provided a repro if it was broken) |
Beta Was this translation helpful? Give feedback.
-
Apparently its due to not awaiting ThrowsAsync itself.
|
Beta Was this translation helpful? Give feedback.
Apparently its due to not awaiting ThrowsAsync itself.