Skip to content

Commit ed0ef91

Browse files
Fix review comments
1 parent 4f5ba0b commit ed0ef91

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1612UnitTests.cs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,13 @@ namespace StyleCop.Analyzers.Test.DocumentationRules
2020
/// </summary>
2121
public class SA1612UnitTests
2222
{
23-
public static IEnumerable<object[]> DeclarationsWithMemberColumn
24-
{
25-
get
26-
{
27-
yield return new object[] { " public ClassName Method(string foo, string bar, string @new) { return null; }", 22 };
28-
yield return new object[] { " public delegate ClassName Method(string foo, string bar, string @new);", 31 };
29-
yield return new object[] { " public ClassName this[string foo, string bar, string @new] { get { return null; } set { } }", 22 };
30-
}
31-
}
32-
3323
public static IEnumerable<object[]> Declarations
3424
{
3525
get
3626
{
37-
return DeclarationsWithMemberColumn.Select(x => new[] { x[0] });
27+
yield return new object[] { " public ClassName {|#0:Method|}(string foo, string bar, string @new) { return null; }" };
28+
yield return new object[] { " public delegate ClassName {|#0:Method|}(string foo, string bar, string @new);" };
29+
yield return new object[] { " public ClassName {|#0:this|}[string foo, string bar, string @new] { get { return null; } set { } }" };
3830
}
3931
}
4032

@@ -404,8 +396,8 @@ public class ClassName
404396
}
405397

406398
[Theory]
407-
[MemberData(nameof(DeclarationsWithMemberColumn))]
408-
public async Task VerifyIncludedMemberWithInvalidParamsIsReportedAsync(string declaration, int memberColumn)
399+
[MemberData(nameof(Declarations))]
400+
public async Task VerifyIncludedMemberWithInvalidParamsIsReportedAsync(string declaration)
409401
{
410402
var testCode = @"
411403
/// <summary>
@@ -419,9 +411,9 @@ public class ClassName
419411

420412
var expected = new[]
421413
{
422-
Diagnostic().WithLocation(8, memberColumn).WithArguments("boo"),
423-
Diagnostic().WithLocation(8, memberColumn).WithArguments("far"),
424-
Diagnostic().WithLocation(8, memberColumn).WithArguments("foe"),
414+
Diagnostic().WithLocation(0).WithArguments("boo"),
415+
Diagnostic().WithLocation(0).WithArguments("far"),
416+
Diagnostic().WithLocation(0).WithArguments("foe"),
425417
};
426418

427419
await VerifyCSharpDiagnosticAsync(testCode.Replace("$$", declaration), expected, CancellationToken.None).ConfigureAwait(false);
@@ -443,8 +435,8 @@ public class ClassName
443435
}
444436

445437
[Theory]
446-
[MemberData(nameof(DeclarationsWithMemberColumn))]
447-
public async Task VerifyIncludedMemberWithAllDocumentationWrongOrderIsReportedAsync(string declaration, int memberColumn)
438+
[MemberData(nameof(Declarations))]
439+
public async Task VerifyIncludedMemberWithAllDocumentationWrongOrderIsReportedAsync(string declaration)
448440
{
449441
var testCode = @"
450442
/// <summary>
@@ -461,9 +453,9 @@ public class ClassName
461453

462454
var expected = new[]
463455
{
464-
diagnostic.WithLocation(8, memberColumn).WithArguments("new", 3),
465-
diagnostic.WithLocation(8, memberColumn).WithArguments("foo", 1),
466-
diagnostic.WithLocation(8, memberColumn).WithArguments("bar", 2),
456+
diagnostic.WithLocation(0).WithArguments("new", 3),
457+
diagnostic.WithLocation(0).WithArguments("foo", 1),
458+
diagnostic.WithLocation(0).WithArguments("bar", 2),
467459
};
468460

469461
await VerifyCSharpDiagnosticAsync(testCode.Replace("$$", declaration), expected, CancellationToken.None).ConfigureAwait(false);
@@ -483,16 +475,16 @@ public class ClassName
483475

484476
expected = new[]
485477
{
486-
diagnostic.WithLocation(8, memberColumn).WithArguments("foo", 1),
487-
diagnostic.WithLocation(8, memberColumn).WithArguments("bar", 2),
478+
diagnostic.WithLocation(0).WithArguments("foo", 1),
479+
diagnostic.WithLocation(0).WithArguments("bar", 2),
488480
};
489481

490482
await VerifyCSharpDiagnosticAsync(testCode.Replace("$$", declaration), testSettings, expected, CancellationToken.None).ConfigureAwait(false);
491483
}
492484

493485
[Theory]
494-
[MemberData(nameof(DeclarationsWithMemberColumn))]
495-
public async Task VerifyIncludedMemberWithTooManyDocumentationIsReportedAsync(string declaration, int memberColumn)
486+
[MemberData(nameof(Declarations))]
487+
public async Task VerifyIncludedMemberWithTooManyDocumentationIsReportedAsync(string declaration)
496488
{
497489
var testCode = @"
498490
/// <summary>
@@ -507,7 +499,7 @@ public class ClassName
507499
var diagnostic = Diagnostic()
508500
.WithMessageFormat("The parameter documentation for '{0}' should be at position {1}");
509501

510-
var expected = diagnostic.WithLocation(8, memberColumn).WithArguments("bar", 2);
502+
var expected = diagnostic.WithLocation(0).WithArguments("bar", 2);
511503

512504
await VerifyCSharpDiagnosticAsync(testCode.Replace("$$", declaration), expected, CancellationToken.None).ConfigureAwait(false);
513505
}

0 commit comments

Comments
 (0)