This question is locked. New answers and comments are not allowed.
I'm using NSubstitute for some unit testing, and I have some scenarios where I want to return a certain exception, rather than the expected data type.
var service =
new
FooService();
service.Repository = Substitute.For<IRepository>();
service.Repository.GetWidgetById(0).Returns(x => {
throw
new
WidgetException(); });
Normally, this would be the kind of thing I would want to be warned about; the return type doesn't match the signature of the method it's extending.
Currently, I'm manually ignoring those errors, but I was wondering if there was a way to exempt certain definitions or libraries from certain analysis rules.
Thanks!