Skip to content

Commit 0bb080b

Browse files
committed
Update SA1618 for partial methods
1 parent b97e869 commit 0bb080b

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/DocumentationRules/SA1618CSharp9UnitTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,35 @@
33

44
namespace StyleCop.Analyzers.Test.CSharp9.DocumentationRules
55
{
6+
using System.Threading;
7+
using System.Threading.Tasks;
68
using StyleCop.Analyzers.Test.CSharp8.DocumentationRules;
9+
using Xunit;
10+
using static StyleCop.Analyzers.Test.Verifiers.CustomDiagnosticVerifier<StyleCop.Analyzers.DocumentationRules.SA1618GenericTypeParametersMustBeDocumented>;
711

812
public partial class SA1618CSharp9UnitTests : SA1618CSharp8UnitTests
913
{
14+
[Fact]
15+
[WorkItem(3971, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3971")]
16+
public async Task TestPartialMethodDeclarationMissingTypeParameterDocumentationAsync()
17+
{
18+
var testCode = @"
19+
/// <summary>
20+
/// Tests a partial method.
21+
/// </summary>
22+
public partial class TestClass
23+
{
24+
/// <summary>Declaration.</summary>
25+
public partial void TestMethod<{|#0:T|}>();
26+
27+
public partial void TestMethod<T>()
28+
{
29+
}
30+
}";
31+
32+
var expected = Diagnostic().WithLocation(0).WithArguments("T");
33+
34+
await VerifyCSharpDiagnosticAsync(testCode, new[] { expected }, CancellationToken.None).ConfigureAwait(false);
35+
}
1036
}
1137
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1618UnitTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ private void Test2<T>(int arg) { }
427427
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
428428
}
429429

430-
private static Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult expected, CancellationToken cancellationToken)
430+
protected static Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult expected, CancellationToken cancellationToken)
431431
=> VerifyCSharpDiagnosticAsync(source, new[] { expected }, cancellationToken);
432432

433-
private static Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult[] expected, CancellationToken cancellationToken)
433+
protected static Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult[] expected, CancellationToken cancellationToken)
434434
{
435435
string contentClassWithTypeparamDoc = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
436436
<TestClass>

0 commit comments

Comments
 (0)