Skip to content

Commit 8056de6

Browse files
committed
Use markup syntax for SA1649 tests
1 parent 75795f8 commit 8056de6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1649UnitTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task VerifyWrongFileNameAsync(string typeKeyword)
4848
{
4949
var testCode = $@"namespace TestNamespace
5050
{{
51-
public {typeKeyword} TestType
51+
public {typeKeyword} {{|#0:TestType|}}
5252
{{
5353
}}
5454
}}
@@ -62,7 +62,7 @@ public async Task VerifyWrongFileNameAsync(string typeKeyword)
6262
}}
6363
";
6464

65-
var expectedDiagnostic = Diagnostic().WithLocation("WrongFileName.cs", 3, 13 + typeKeyword.Length);
65+
var expectedDiagnostic = Diagnostic().WithLocation(0);
6666
await VerifyCSharpFixAsync("WrongFileName.cs", testCode, StyleCopSettings, expectedDiagnostic, "TestType.cs", fixedCode, CancellationToken.None).ConfigureAwait(false);
6767
}
6868

@@ -78,7 +78,7 @@ public async Task VerifyWrongFileNameMultipleExtensionsAsync(string typeKeyword)
7878
{
7979
var testCode = $@"namespace TestNamespace
8080
{{
81-
public {typeKeyword} TestType
81+
public {typeKeyword} {{|#0:TestType|}}
8282
{{
8383
}}
8484
}}
@@ -92,7 +92,7 @@ public async Task VerifyWrongFileNameMultipleExtensionsAsync(string typeKeyword)
9292
}}
9393
";
9494

95-
var expectedDiagnostic = Diagnostic().WithLocation("WrongFileName.svc.cs", 3, 13 + typeKeyword.Length);
95+
var expectedDiagnostic = Diagnostic().WithLocation(0);
9696
await VerifyCSharpFixAsync("WrongFileName.svc.cs", testCode, StyleCopSettings, expectedDiagnostic, "TestType.svc.cs", fixedCode, CancellationToken.None).ConfigureAwait(false);
9797
}
9898

@@ -108,7 +108,7 @@ public async Task VerifyWrongFileNameNoExtensionAsync(string typeKeyword)
108108
{
109109
var testCode = $@"namespace TestNamespace
110110
{{
111-
public {typeKeyword} TestType
111+
public {typeKeyword} {{|#0:TestType|}}
112112
{{
113113
}}
114114
}}
@@ -122,7 +122,7 @@ public async Task VerifyWrongFileNameNoExtensionAsync(string typeKeyword)
122122
}}
123123
";
124124

125-
var expectedDiagnostic = Diagnostic().WithLocation("WrongFileName", 3, 13 + typeKeyword.Length);
125+
var expectedDiagnostic = Diagnostic().WithLocation(0);
126126
await VerifyCSharpFixAsync("WrongFileName", testCode, StyleCopSettings, expectedDiagnostic, "TestType", fixedCode, CancellationToken.None).ConfigureAwait(false);
127127
}
128128

@@ -201,13 +201,13 @@ public async Task VerifyStyleCopNamingConventionForGenericTypeAsync(string typeK
201201
{
202202
var testCode = $@"namespace TestNamespace
203203
{{
204-
public {typeKeyword} TestType<T1, T2, T3>
204+
public {typeKeyword} {{|#0:TestType|}}<T1, T2, T3>
205205
{{
206206
}}
207207
}}
208208
";
209209

210-
var expectedDiagnostic = Diagnostic().WithLocation("TestType`3.cs", 3, 13 + typeKeyword.Length);
210+
var expectedDiagnostic = Diagnostic().WithLocation(0);
211211
await VerifyCSharpDiagnosticAsync("TestType.cs", testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
212212
await VerifyCSharpFixAsync("TestType`3.cs", testCode, StyleCopSettings, expectedDiagnostic, "TestType{T1,T2,T3}.cs", testCode, CancellationToken.None).ConfigureAwait(false);
213213
}
@@ -223,16 +223,16 @@ public async Task VerifyMetadataNamingConventionForGenericTypeAsync(string typeK
223223
{
224224
var testCode = $@"namespace TestNamespace
225225
{{
226-
public {typeKeyword} TestType<T1, T2, T3>
226+
public {typeKeyword} {{|#0:TestType|}}<T1, T2, T3>
227227
{{
228228
}}
229229
}}
230230
";
231231

232-
var expectedDiagnostic = Diagnostic().WithLocation("TestType{T1,T2,T3}.cs", 3, 13 + typeKeyword.Length);
232+
var expectedDiagnostic = Diagnostic().WithLocation(0);
233233
await VerifyCSharpFixAsync("TestType{T1,T2,T3}.cs", testCode, MetadataSettings, expectedDiagnostic, "TestType`3.cs", testCode, CancellationToken.None).ConfigureAwait(false);
234234

235-
expectedDiagnostic = Diagnostic().WithLocation("TestType.cs", 3, 13 + typeKeyword.Length);
235+
expectedDiagnostic = Diagnostic().WithLocation(0);
236236
await VerifyCSharpFixAsync("TestType.cs", testCode, MetadataSettings, expectedDiagnostic, "TestType`3.cs", testCode, CancellationToken.None).ConfigureAwait(false);
237237
}
238238

@@ -248,7 +248,7 @@ public async Task VerifyMetadataNamingConventionForGenericTypeMultipleExtensions
248248
{
249249
var testCode = $@"namespace TestNamespace
250250
{{
251-
public {typeKeyword} TestType<T>
251+
public {typeKeyword} {{|#0:TestType|}}<T>
252252
{{
253253
}}
254254
}}
@@ -262,7 +262,7 @@ public async Task VerifyMetadataNamingConventionForGenericTypeMultipleExtensions
262262
}}
263263
";
264264

265-
var expectedDiagnostic = Diagnostic().WithLocation("TestType.svc.cs", 3, 13 + typeKeyword.Length);
265+
var expectedDiagnostic = Diagnostic().WithLocation(0);
266266
await VerifyCSharpFixAsync("TestType.svc.cs", testCode, MetadataSettings, expectedDiagnostic, "TestType`1.svc.cs", fixedCode, CancellationToken.None).ConfigureAwait(false);
267267
}
268268

0 commit comments

Comments
 (0)