Skip to content

Commit f70a2de

Browse files
committed
Consolidate test sequence in SA1101UnitTests
1 parent 6f50491 commit f70a2de

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1101UnitTests.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ namespace StyleCop.Analyzers.Test.ReadabilityRules
1414

1515
public class SA1101UnitTests : CodeFixVerifier
1616
{
17-
private const string ReferenceCode = @"
17+
[Fact]
18+
public async Task TestPrefixLocalCallsWithThisAsync()
19+
{
20+
string testCode = @"
1821
using System;
1922
public class BaseTypeName
2023
{
@@ -130,7 +133,7 @@ public void InstanceMethodName(int ParameterName)
130133
}
131134
";
132135

133-
private static readonly string FixedCode = @"
136+
string fixedCode = @"
134137
using System;
135138
public class BaseTypeName
136139
{
@@ -246,9 +249,6 @@ public void InstanceMethodName(int ParameterName)
246249
}
247250
";
248251

249-
[Fact]
250-
public async Task TestPrefixLocalCallsWithThisDiagnosticsAsync()
251-
{
252252
var expected = new[]
253253
{
254254
this.CSharpDiagnostic().WithLocation(91, 36),
@@ -260,7 +260,9 @@ public async Task TestPrefixLocalCallsWithThisDiagnosticsAsync()
260260
this.CSharpDiagnostic().WithLocation(107, 48),
261261
};
262262

263-
await this.VerifyCSharpDiagnosticAsync(ReferenceCode, expected, CancellationToken.None).ConfigureAwait(false);
263+
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
264+
await this.VerifyCSharpDiagnosticAsync(fixedCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
265+
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
264266
}
265267

266268
[Fact]
@@ -300,12 +302,6 @@ public void ConvertAll<T>(T value) { }
300302
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
301303
}
302304

303-
[Fact]
304-
public async Task TestPrefixLocalCallsWithThisCodeFixAsync()
305-
{
306-
await this.VerifyCSharpFixAsync(ReferenceCode, FixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
307-
}
308-
309305
/// <summary>
310306
/// Verifies that a collision between a member and a static member is handled properly.
311307
/// This is a regression test for #2093

0 commit comments

Comments
 (0)