Skip to content

nsubstitute/NSubstitute.Analyzers

Repository files navigation

Analyzers to detect possible NSubstitute usage problems, such as attempts to setup non-virtual members.

Branch Build Coverage
Master Build status Coverage Status
Dev Build status Coverage Status

Install via NuGet

Motivation

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).

Documentation

For documentation and reasoning on the rules themselves, see the Documentation.

Support

Please report any problems or ask questions via the Issue tracker.