Skip to content

Commit

Permalink
fix unit tests: Language was the wrong string
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Mar 13, 2023
1 parent 04574d7 commit 28f2a29
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -172,16 +172,17 @@ public void ProjectConfiguration_WhenInvalidXml_ThrowException()
}

[DataTestMethod]
[DataRow(LanguageNames.CSharp, "cs")]
[DataRow(LanguageNames.VisualBasic, "vbnet")]
public void SonarLintFile_LoadsExpectedValues(AnalyzerLanguage language, string xmlLanguageName)
[DataRow("cs")]
[DataRow("vbnet")]
public void SonarLintFile_LoadsExpectedValues(string language)
{
var (compilation, _) = CreateDummyCompilation(language, "ExtraEmptyFile");
var options = AnalysisScaffolding.CreateOptions($"ResourceTests\\SonarLintXml\\All_properties_{xmlLanguageName}\\SonarLint.xml");
var analyzerLanguage = language == "cs" ? AnalyzerLanguage.CSharp : AnalyzerLanguage.VisualBasic;
var (compilation, _) = CreateDummyCompilation(analyzerLanguage, "ExtraEmptyFile");
var options = AnalysisScaffolding.CreateOptions($"ResourceTests\\SonarLintXml\\All_properties_{language}\\SonarLint.xml");
var sut = CreateSut(compilation, options).SonarLintFile();

sut.IgnoreHeaderComments(language.ToString()).Should().BeTrue();
sut.AnalyzeGeneratedCode(language.ToString()).Should().BeFalse();
sut.IgnoreHeaderComments(analyzerLanguage.ToString()).Should().BeTrue();
sut.AnalyzeGeneratedCode(analyzerLanguage.ToString()).Should().BeFalse();
AssertArrayContent(sut.Exclusions, nameof(sut.Exclusions));
AssertArrayContent(sut.Inclusions, nameof(sut.Inclusions));
AssertArrayContent(sut.GlobalExclusions, nameof(sut.GlobalExclusions));
Expand Down

0 comments on commit 28f2a29

Please sign in to comment.