Class is an NUnit TestFixture and is instantiated using reflection
Class is a NUnit TestFixture and called by reflection
The default roslyn analyzer has rule CA1812 which warns about internal classes not being used. That analyzer doesn't know about NUnit test classes. This suppressor catches the error, verifies the class is an NUnit TestFixture and if so suppresses the error.
The rule has no severity, but can be disabled.
Via ruleset file
To disable the rule for a project, you need to add a ruleset file
<?xml version="1.0" encoding="utf-8"?> <RuleSet Name="NUnit.Analyzer Suppressions" Description="DiagnosticSuppression Rules" ToolsVersion="12.0"> <Rules AnalyzerId="DiagnosticSuppressors" RuleNamespace="NUnit.NUnitAnalyzers"> <Rule Id="NUnit3001" Action="Info" /> <!-- Possible Null Reference --> <Rule Id="NUnit3002" Action="Info" /> <!-- NonNullableField/Property is Uninitialized --> <Rule Id="NUnit3003" Action="Info" /> <!-- Avoid Uninstantiated Internal Classes --> <Rule Id="NUnit3004" Action="Info" /> <!-- Types that own disposable fields should be disposable --> </Rules> </RuleSet>
and add it to the project like:
<PropertyGroup> <CodeAnalysisRuleSet>NUnit.Analyzers.Suppressions.ruleset</CodeAnalysisRuleSet> </PropertyGroup>
For more info about rulesets see MSDN.
Via .editorconfig file
This is currently not working. Waiting for Roslyn
# NUnit3003: Class is an NUnit TestFixture and is instantiated using reflection dotnet_diagnostic.NUnit3003.severity = none