Skip to content

Commit 120a6a5

Browse files
Improve coverage for SA1404 by adding test for full attribute name
1 parent eb324ac commit 120a6a5

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/SA1404UnitTests.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ namespace StyleCop.Analyzers.Test.MaintainabilityRules
1616

1717
public class SA1404UnitTests
1818
{
19-
[Fact]
20-
public async Task TestSuppressionWithStringLiteralAsync()
19+
[Theory]
20+
[InlineData("SuppressMessage")]
21+
[InlineData("SuppressMessageAttribute")]
22+
public async Task TestSuppressionWithStringLiteralAsync(string attributeName)
2123
{
22-
var testCode = @"public class Foo
23-
{
24-
[System.Diagnostics.CodeAnalysis.SuppressMessage(null, null, Justification = ""a justification"")]
24+
var testCode = $@"public class Foo
25+
{{
26+
[System.Diagnostics.CodeAnalysis.{attributeName}(null, null, Justification = ""a justification"")]
2527
public void Bar()
26-
{
28+
{{
2729
28-
}
29-
}";
30+
}}
31+
}}";
3032

3133
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
3234
}

0 commit comments

Comments
 (0)