Skip to content

Commit 7885adb

Browse files
Improve coverage for SA1213 by adding test with only one accessor
1 parent 120a6a5 commit 7885adb

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/SA1213UnitTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,23 @@ public event EventHandler NameChanged
242242

243243
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
244244
}
245+
246+
[Fact]
247+
public async Task TestOnlyAddAccessorAsync()
248+
{
249+
var testCode = @"
250+
using System;
251+
public class Foo
252+
{
253+
private EventHandler nameChanged;
254+
255+
public event EventHandler {|CS0065:NameChanged|}
256+
{
257+
add { this.nameChanged += value; }
258+
}
259+
}";
260+
261+
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
262+
}
245263
}
246264
}

0 commit comments

Comments
 (0)