Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Feb 26, 2021
1 parent ed79a06 commit 7f62199
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 45 deletions.
44 changes: 0 additions & 44 deletions tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs
Expand Up @@ -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<string> list = new List<string>();
int count = 5;
}
}";

var expectedCode = @"
using System.Collections.Generic;
class C
{
void M()
{
object obj = new object();
List<string> list = new List<string>();
int count = 5;
}
}";

var editorConfig = new Dictionary<string, string>()
{
/// 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" });
}
}
}
2 changes: 1 addition & 1 deletion tests/CodeFormatterTests.cs
Expand Up @@ -543,7 +543,7 @@ public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors()
fixCategory,
codeStyleSeverity,
analyzerSeverity,
diagnostics?.ToImmutableHashSet() ?? default,
diagnostics?.ToImmutableHashSet() ?? ImmutableHashSet<string>.Empty,
saveFormattedFiles: false,
changesAreErrors: false,
fileMatcher,
Expand Down

0 comments on commit 7f62199

Please sign in to comment.