提交 9e275d45 编写于 作者: J jnm2

Fails to recognize existing GlobalSuppressions.cs having using directive

上级 1113a88f
......@@ -1539,6 +1539,39 @@ class Class { }
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification = ""<Pending>"", Scope = ""type"", Target = ""Class"")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification = ""{FeaturesResources.Pending}"", Scope = ""type"", Target = ""~T:Class2"")]
";
await TestAsync(initialMarkup, expectedText);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSuppression)]
public async Task TestSuppressionWithUsingDirectiveInExistingGlobalSuppressionsDocument()
{
var initialMarkup = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
<Document FilePath=""CurrentDocument.cs""><![CDATA[
using System;
class Class { }
[|class Class2|] { }
]]>
</Document>
<Document FilePath=""GlobalSuppressions.cs""><![CDATA[
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification = ""<Pending>"", Scope = ""type"", Target = ""Class"")]
]]>
</Document>
</Project>
</Workspace>";
var expectedText =
$@"
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification = ""<Pending>"", Scope = ""type"", Target = ""Class"")]
[assembly: SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification = ""{FeaturesResources.Pending}"", Scope = ""type"", Target = ""~T:Class2"")]
";
await TestAsync(initialMarkup, expectedText);
......
......@@ -1558,6 +1558,39 @@ End Class
<Assembly: Diagnostics.CodeAnalysis.SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification:=""<Pending>"", Scope:=""type"", Target:=""Class1"")>
<Assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification:=""{FeaturesResources.Pending}"", Scope:=""type"", Target:=""~T:Class2"")>
"
Await TestAsync(source.ToString(), expected)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsSuppression)>
Public Async Function TestSuppressionWithUsingDirectiveInExistingGlobalSuppressionsDocument() As Task
Dim source =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document FilePath="CurrentDocument.vb"><![CDATA[
Imports System
Class Class1
End Class
[|Class Class2|]
End Class]]>
</Document>
<Document FilePath="GlobalSuppressions.vb"><![CDATA[
Imports System.Diagnostics.CodeAnalysis
<Assembly: SuppressMessage("InfoDiagnostic", "InfoDiagnostic:InfoDiagnostic", Justification:="<Pending>", Scope:="type", Target:="Class1")>
]]>
</Document>
</Project>
</Workspace>
Dim expected = $"
Imports System.Diagnostics.CodeAnalysis
<Assembly: SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification:=""<Pending>"", Scope:=""type"", Target:=""Class1"")>
<Assembly: SuppressMessage(""InfoDiagnostic"", ""InfoDiagnostic:InfoDiagnostic"", Justification:=""{FeaturesResources.Pending}"", Scope:=""type"", Target:=""~T:Class2"")>
"
Await TestAsync(source.ToString(), expected)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册