Background
I can assert that an action throws, using a generic parameter:
action.Should().Throw<SomeException>();
Feature Request
Please consider adding an overload that takes an instance as well:
action.Should().Throw(expectedType);
This would be very useful when I don't know the type at compile time.
Right now we need to use an ugly workaround:
try {
action();
}
catch (Exception e) {
e.Should().BeOfType(expectedType);
}
Versions
- Which version of Fluent Assertions are you using? 5.10.3
- Which .NET runtime and version are you targeting? 5.0.301