GU0018b
November 24, 2021 · View on GitHub
Name mock
| Topic | Value |
|---|---|
| Id | GU0018b |
| Severity | Hidden |
| Enabled | True |
| Category | Gu.Analyzers.Correctness |
| Code | VariableDeclaratorAnalyzer |
Description
Name mock.
Motivation
namespace N { using Moq; using NUnit.Framework;
public class C
{
[Test]
public void M()
{
var ↓mock = new Mock<IPlc>(MockBehavior.Strict);
}
}
}
How to fix violations
namespace N { using Moq; using NUnit.Framework;
public class C
{
[Test]
public void M()
{
var plcMock = new Mock<IPlc>(MockBehavior.Strict);
}
}
}
Configure severity
Via ruleset file.
Configure the severity per project, for more info see MSDN.
Via #pragma directive.
#pragma warning disable GU0018b // Name mock
Code violating the rule here
#pragma warning restore GU0018b // Name mock
Or put this at the top of the file to disable all instances.
#pragma warning disable GU0018b // Name mock
Via attribute [SuppressMessage].
[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness",
"GU0018b:Name mock",
Justification = "Reason...")]