Skip to content

Commit 355e690

Browse files
committed
Simplify tests in SA1121UnitTests
1 parent 3c635f8 commit 355e690

1 file changed

Lines changed: 8 additions & 34 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1121UnitTests.cs

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -775,23 +775,6 @@ public void Bar()
775775

776776
[Fact]
777777
public async Task TestMissleadingUsingAsync()
778-
{
779-
string testCode = @"namespace Foo
780-
{
781-
using Int32 = System.UInt32;
782-
class Bar
783-
{
784-
Int32 value = 3;
785-
}
786-
}
787-
";
788-
DiagnosticResult expected = this.CSharpDiagnostic().WithLocation(6, 5);
789-
790-
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
791-
}
792-
793-
[Fact]
794-
public async Task TestMissleadingUsingCodeFixAsync()
795778
{
796779
string oldSource = @"namespace Foo
797780
{
@@ -812,28 +795,15 @@ class Bar
812795
}
813796
";
814797

815-
await this.VerifyCSharpFixAsync(oldSource, newSource, allowNewCompilerDiagnostics: true).ConfigureAwait(false);
816-
}
817-
818-
[Fact]
819-
public async Task TestUsingNameChangeAsync()
820-
{
821-
string testCode = @"namespace Foo
822-
{
823-
using MyInt = System.UInt32;
824-
class Bar
825-
{
826-
MyInt value = 3;
827-
}
828-
}
829-
";
830798
DiagnosticResult expected = this.CSharpDiagnostic().WithLocation(6, 5);
831799

832-
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
800+
await this.VerifyCSharpDiagnosticAsync(oldSource, expected, CancellationToken.None).ConfigureAwait(false);
801+
await this.VerifyCSharpDiagnosticAsync(newSource, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
802+
await this.VerifyCSharpFixAsync(oldSource, newSource, allowNewCompilerDiagnostics: true).ConfigureAwait(false);
833803
}
834804

835805
[Fact]
836-
public async Task TestUsingNameChangeCodeFixAsync()
806+
public async Task TestUsingNameChangeAsync()
837807
{
838808
string oldSource = @"namespace Foo
839809
{
@@ -854,6 +824,10 @@ class Bar
854824
}
855825
";
856826

827+
DiagnosticResult expected = this.CSharpDiagnostic().WithLocation(6, 5);
828+
829+
await this.VerifyCSharpDiagnosticAsync(oldSource, expected, CancellationToken.None).ConfigureAwait(false);
830+
await this.VerifyCSharpDiagnosticAsync(newSource, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
857831
await this.VerifyCSharpFixAsync(oldSource, newSource, allowNewCompilerDiagnostics: true).ConfigureAwait(false);
858832
}
859833

0 commit comments

Comments
 (0)