From 7f621992ab994b7ff7db4777bf380784d1ab3097 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 08:51:42 -0800 Subject: [PATCH] Fix tests --- .../CodeStyleAnalyzerFormatterTests.cs | 44 ------------------- tests/CodeFormatterTests.cs | 2 +- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs index 08ee41c7df..01dd7b51f5 100644 --- a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs +++ b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs @@ -74,49 +74,5 @@ public int M() await AssertNoReportedFileChangesAsync(testCode, "root = true", fixCategory: FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); } - - [Fact] - public async Task TestUnusedImport_AppliesWhenIDE0005InDiagnosticsList() - { - var testCode = @" -using System.Buffers; -using System.Collections.Generic; - -class C -{ - void M() - { - object obj = new object(); - List list = new List(); - int count = 5; - } -}"; - - var expectedCode = @" -using System.Collections.Generic; - -class C -{ - void M() - { - object obj = new object(); - List list = new List(); - int count = 5; - } -}"; - - var editorConfig = new Dictionary() - { - /// IDE0005: Using directive is unnecessary - ["dotnet_diagnostic.IDE0005.severity"] = "error", - /// Prefer "var" everywhere - ["dotnet_diagnostic.IDE0007.severity"] = "error", - ["csharp_style_var_for_built_in_types"] = "true:error", - ["csharp_style_var_when_type_is_apparent"] = "true:error", - ["csharp_style_var_elsewhere"] = "true:error", - }; - - await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.CodeStyle, diagnostics: new[] { "IDE0005" }); - } } } diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 3f627ed5ad..2f43c2f852 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -543,7 +543,7 @@ public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() fixCategory, codeStyleSeverity, analyzerSeverity, - diagnostics?.ToImmutableHashSet() ?? default, + diagnostics?.ToImmutableHashSet() ?? ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, fileMatcher,