CheckId | NS2006 |
Category | Substitute creation |
Substituting for interface and passing arguments.
A violation of this rule occurs when arguments are passed to Substitute.For
when substituting for an interface.
To fix a violation of this rule, remove all constructor parameters from Substitute.For
invocation.
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.