Skip to content

Commit bc0e71c

Browse files
committed
Created regression test for #1943
1 parent e60c596 commit bc0e71c

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1623UnitTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,39 @@ private class PrivateTestClass
152152
await this.VerifyCSharpFixAsync(testCode, fixedTestCode).ConfigureAwait(false);
153153
}
154154

155+
/// <summary>
156+
/// Verifies that empty summary tag does not throw an exception.
157+
/// Regression test for #1943
158+
/// </summary>
159+
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
160+
[Fact]
161+
public async Task EmptySummaryTagShouldNotThrowAnExceptionAsync()
162+
{
163+
var testCode = @"public class ClassName
164+
{
165+
/// <summary></summary>
166+
public int Property
167+
{
168+
get;
169+
}
170+
}";
171+
172+
var fixedTestCode = @"public class ClassName
173+
{
174+
/// <summary>Gets Property</summary>
175+
public int Property
176+
{
177+
get;
178+
}
179+
}";
180+
181+
var expected = this.CSharpDiagnostic(PropertySummaryDocumentationAnalyzer.SA1623Descriptor).WithLocation(4, 16).WithArguments("Gets");
182+
183+
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
184+
await this.VerifyCSharpDiagnosticAsync(fixedTestCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
185+
await this.VerifyCSharpFixAsync(testCode, fixedTestCode).ConfigureAwait(false);
186+
}
187+
155188
/// <inheritdoc/>
156189
protected override CodeFixProvider GetCSharpCodeFixProvider()
157190
{

0 commit comments

Comments
 (0)