From 0fd56df3f828ff3cdbe780af7121440857754189 Mon Sep 17 00:00:00 2001 From: JieCarolHu Date: Tue, 30 Jan 2018 15:41:59 -0800 Subject: [PATCH] adding test case DoNotSuggestVarForExplicitInterfaceImplementations --- .../UseImplicitTypeTests.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs index 01cc0017435..f889f5112d9 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs @@ -2209,5 +2209,34 @@ static void Main(string[] args) delegate object GetHandler(); }", new TestParameters(options: ImplicitTypeEverywhere())); } + + [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)] + [WorkItem(24262, "https://github.com/dotnet/roslyn/issues/24262")] + public async Task DoNotSuggestVarForExplicitInterfaceImplementations() + { + await TestMissingInRegularAndScriptAsync(@" +public interface ITest +{ + string Value { get; } +} +public class TestInstance : ITest +{ + string ITest.Value => ""Hi""; +} + +public class Test +{ + public TestInstance[] Instances { get; } + + public void TestIt() + { + foreach ([|ITest|] test in Instances) + { + Console.WriteLine(test.Value); + } + } +} +", new TestParameters(options: ImplicitTypeEverywhere())); + } } } -- GitLab