Skip to content

Commit 1c248f2

Browse files
authored
Merge pull request #2625 from sharwell/sa1101-added-test
Add a test for static members in SA1101
2 parents 25c039e + 8780496 commit 1c248f2

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1101UnitTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,24 @@ public class TestClass
345345
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
346346
}
347347

348+
[Fact]
349+
[WorkItem(2211, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2211")]
350+
public async Task TestStaticMemberAliasesPropertyAsync()
351+
{
352+
var testCode = @"
353+
using System;
354+
355+
public class Foo
356+
{
357+
public Array Array { get; } = new int[0];
358+
359+
public int IndexOf(object value) => Array.IndexOf(this.Array, value);
360+
}
361+
";
362+
363+
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
364+
}
365+
348366
protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers()
349367
{
350368
yield return new SA1101PrefixLocalCallsWithThis();

0 commit comments

Comments
 (0)