-
Notifications
You must be signed in to change notification settings - Fork 280
Open
Labels
Description
Describe the bug
A private static
field of type TestContext
causes a false positive for rule MSTEST0005:
Property 'TestContext' should be valid
Steps To Reproduce
The following code:
[TestClass]
public class MiseCorrelationIdProviderTests
{
private static TestContext _context;
[ClassInitialize]
public static void ClassInitialize(TestContext context) =>
_context = context;
}
causes the following warning:
Expected behavior
A field does not trigger a rule for a property.
Actual behavior
It does.
Additional context
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.7.0" />
<PackageVersion Include="MSTest.TestFramework" Version="3.7.0" />
<GlobalPackageReference Include="MSTest.Analyzers" Version="3.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</GlobalPackageReference>