The following Func
delegate throws an ArgumentNullException
:
Func<Task> act = async () => await _someService
.someMethod(1, 2, 3, 4);
Using Fluent assertions, the assertion:
act.Should().ThrowExactlyAsync<ArgumentException>();
Should fail:
Asserts that the current
Func
throws an exception of the exact typeTException
(and not a derived exception type).
ArgumentNullException
derives from ArgumentException
, given the description, the assertion should fail, but it passes.
Is it a bug or am I misusing this?