From 75d8c9d76b8438ed2ead7921158a2dececcc0942 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 2 Oct 2020 19:16:42 +0800 Subject: [PATCH] Move and rename test. --- .../UseIsNullCheckForReferenceEqualsTests.cs | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs b/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs index 0170d6a92d0..f54a5b322a1 100644 --- a/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs +++ b/src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs @@ -262,7 +262,7 @@ void M(string s1, string s2) [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] - public async Task TestValueParameterTypeIsUnconstrainedGeneric() + public async Task TestValueParameterTypeIsUnconstrainedGeneric_CSharp7() { await TestInRegularAndScript1Async( @" @@ -290,6 +290,37 @@ public static void NotNull(T value) ", new TestParameters(parseOptions: CSharp7)); } + [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] + public async Task TestValueParameterTypeIsUnconstrainedGeneric_CSharp8() + { + await TestInRegularAndScript1Async( +@"using System; + +class C +{ + public static void NotNull(T value) + { + if ({|FixAllInDocument:ReferenceEquals|}(value, null)) + { + return; + } + } +}", +@"using System; + +class C +{ + public static void NotNull(T value) + { + if (value is null) + { + return; + } + } +}", new TestParameters(parseOptions: CSharp8)); + } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGenericNegated_CSharp7() { @@ -504,7 +535,7 @@ void M(string s2) [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] - public async Task TestValueParameterTypeIsBaseConstraintGeneric() + public async Task TestValueParameterTypeIsBaseTypeConstraintGeneric() { await TestInRegularAndScript1Async( @"using System; @@ -532,36 +563,5 @@ class C } }", new TestParameters(parseOptions: CSharp7)); } - - [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] - public async Task TestUnconstrainedGenericInCSharp8() - { - await TestInRegularAndScript1Async( -@"using System; - -class C -{ - public static void NotNull(T value) - { - if ({|FixAllInDocument:ReferenceEquals|}(value, null)) - { - return; - } - } -}", -@"using System; - -class C -{ - public static void NotNull(T value) - { - if (value is null) - { - return; - } - } -}", new TestParameters(parseOptions: CSharp8)); - } } } -- GitLab