From 3983b32a87b65f3ddb7203760210a28f691c7f48 Mon Sep 17 00:00:00 2001 From: ahmedabdelkabier Date: Thu, 15 Dec 2022 19:57:34 +0200 Subject: [PATCH] Add file-local class test for CA1812 --- .../AvoidUninstantiatedInternalClassesTests.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/Maintainability/AvoidUninstantiatedInternalClassesTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/Maintainability/AvoidUninstantiatedInternalClassesTests.cs index d876245601..b5ef69b745 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/Maintainability/AvoidUninstantiatedInternalClassesTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.CodeQuality.Analyzers/Maintainability/AvoidUninstantiatedInternalClassesTests.cs @@ -17,6 +17,18 @@ namespace Microsoft.CodeQuality.Analyzers.Maintainability.UnitTests { public class AvoidUninstantiatedInternalClassesTests { + [Fact, WorkItem(6049, "https://github.com/dotnet/roslyn-analyzers/issues/6049")] + public async Task CA1812_CSharp_Diagnostic_FileUninstantiatedInternalClassAsync() + { + const string source = "file class [|C|] { }"; + await new VerifyCS.Test + { + TestCode = source, + FixedCode = source, + LanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp11, + }.RunAsync(); + } + [Fact] public async Task CA1812_CSharp_Diagnostic_UninstantiatedInternalClassAsync() {