Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.13 KB

File metadata and controls

39 lines (28 loc) · 1.13 KB

NS2006

CheckId NS2006
Category Substitute creation

Cause

Substituting for interface and passing arguments.

Rule description

A violation of this rule occurs when arguments are passed to Substitute.For when substituting for an interface.

How to fix violations

To fix a violation of this rule, remove all constructor parameters from Substitute.For invocation.

How to suppress violations

This warning can be suppressed by disabling the warning in the ruleset file for the project. The warning can also be suppressed programmatically for an assembly:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Substitute creation", "NS2006:Can not provide constructor arguments when substituting for an interface.", Justification = "Reviewed")]

Or for a specific code block:

#pragma warning disable NS2006 // Can not provide constructor arguments when substituting for an interface.
// the code which produces warning
#pragma warning restore NS2006 // Can not provide constructor arguments when substituting for an interface.