Skip to content

Commit 6d60f39

Browse files
committed
Add tests for SA1206 with the 'readonly', 'ref', and 'partial' keywords
Closes #2578
1 parent 50eb92d commit 6d60f39

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/OrderingRules/SA1206CSharp7UnitTests.cs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,22 @@ namespace StyleCop.Analyzers.Test.CSharp7.OrderingRules
1313

1414
public class SA1206CSharp7UnitTests : SA1206UnitTests
1515
{
16-
[Fact]
17-
public async Task TestRefKeywordInStructDeclarationAsync()
16+
[Theory]
17+
[InlineData("readonly")]
18+
[InlineData("ref")]
19+
[InlineData("readonly ref")]
20+
[InlineData("readonly partial")]
21+
[InlineData("ref partial")]
22+
[InlineData("readonly ref partial")]
23+
[WorkItem(2578, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2578")]
24+
public async Task TestReadonlyRefKeywordInStructDeclarationAsync(string keywords)
1825
{
19-
var testCode = @"class OuterClass
20-
{
21-
private ref struct BitHelper
22-
{
23-
}
24-
}
25-
";
26-
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
27-
}
28-
29-
[Fact]
30-
public async Task TestReadonlyKeywordInStructDeclarationAsync()
31-
{
32-
var testCode = @"class OuterClass
33-
{
34-
private readonly struct BitHelper
35-
{
36-
}
37-
}
26+
var testCode = $@"class OuterClass
27+
{{
28+
private {keywords} struct BitHelper
29+
{{
30+
}}
31+
}}
3832
";
3933
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
4034
}

0 commit comments

Comments
 (0)