Analyzers to detect possible NSubstitute usage problems, such as attempts to setup non-virtual members.
Install via NuGet
NSubstitute was designed with the aim of having concise, friendly syntax for mocking. The downside of this syntax is that certain failure modes are hard to detect. One example is attempting to mock non-virtual members -- NSubstitute can not see these calls so can not communicate problems such as
sub.Received().NonVirtualCall(). Thanks to the goodness of Roslyn analyzers, we now have the option to detect cases like these (as originally proposed in NSubstitute issue #328).
For documentation and reasoning on the rules themselves, see the Documentation.
Please report any problems or ask questions via the Issue tracker.