Skip to content

Commit

Permalink
UTs methods renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianAmbrosini committed Mar 13, 2023
1 parent 0f66528 commit 645d6dd
Showing 1 changed file with 13 additions and 13 deletions.
Expand Up @@ -34,7 +34,7 @@ public class ParameterLoaderTest
[TestMethod]
[DataRow("path//aSonarLint.xml")] // different name
[DataRow("path//SonarLint.xmla")] // different extension
public void SetParameterValues_WhenNoSonarLintIsGiven_DoesNotPopulateParameters(string filePath)
public void SetParameterValues_WithInvalidSonarLintPath_DoesNotPopulateParameters(string filePath)
{
// Arrange
var compilation = CreateCompilationWithOption(filePath, SourceText.From(File.ReadAllText("ResourceTests\\SonarLintXml\\All_properties_cs\\SonarLint.xml")));
Expand All @@ -50,7 +50,7 @@ public void SetParameterValues_WhenNoSonarLintIsGiven_DoesNotPopulateParameters(
[TestMethod]
[DataRow("a/SonarLint.xml")] // unix path
[DataRow("a\\SonarLint.xml")]
public void SetParameterValues_WhenGivenValidSonarLintFilePath_PopulatesProperties(string filePath)
public void SetParameterValues_WithValidSonarLintPath_PopulatesProperties(string filePath)
{
// Arrange
var compilation = CreateCompilationWithOption(filePath, SourceText.From(File.ReadAllText("ResourceTests\\SonarLintXml\\All_properties_cs\\SonarLint.xml")));
Expand All @@ -64,7 +64,7 @@ public void SetParameterValues_WhenGivenValidSonarLintFilePath_PopulatesProperti
}

[TestMethod]
public void SetParameterValues_WhenGivenSonarLintFileHasIntParameterType_PopulatesProperties()
public void SetParameterValues_SonarLintFileWithIntParameterType_PopulatesProperties()
{
// Arrange
var compilation = CreateCompilationWithOption("ResourceTests\\SonarLintXml\\All_properties_cs\\SonarLint.xml");
Expand All @@ -78,11 +78,11 @@ public void SetParameterValues_WhenGivenSonarLintFileHasIntParameterType_Populat
}

[TestMethod]
public void SetParameterValues_WhenGivenSonarLintFileHasStringParameterType_OnlyOneParameter_PopulatesProperty()
public void SetParameterValues_SonarLintFileWithStringParameterType_PopulatesProperty()
{
// Arrange
var parameterValue = "1";
var filePath = GenerateSonarLintWithParametrizedRule("S2342", "flagsAttributeFormat", parameterValue);
var filePath = GenerateSonarLintXmlWithParametrizedRule("S2342", "flagsAttributeFormat", parameterValue);
var compilation = CreateCompilationWithOption(filePath);
var analyzer = new EnumNameShouldFollowRegex(); // Cannot use mock because we use reflection to find properties.

Expand All @@ -94,11 +94,11 @@ public void SetParameterValues_WhenGivenSonarLintFileHasStringParameterType_Only
}

[TestMethod]
public void SetParameterValues_WhenGivenSonarLintFileHasBooleanParameterType_OnlyOneParameter_PopulatesProperty()
public void SetParameterValues_SonarLintFileWithBooleanParameterType_PopulatesProperty()
{
// Arrange
var parameterValue = true;
var filePath = GenerateSonarLintWithParametrizedRule("S1451", "isRegularExpression", parameterValue.ToString());
var filePath = GenerateSonarLintXmlWithParametrizedRule("S1451", "isRegularExpression", parameterValue.ToString());
var compilation = CreateCompilationWithOption(filePath);
var analyzer = new CheckFileLicense(); // Cannot use mock because we use reflection to find properties.

Expand All @@ -110,7 +110,7 @@ public void SetParameterValues_WhenGivenSonarLintFileHasBooleanParameterType_Onl
}

[TestMethod]
public void SetParameterValues_WhenGivenValidSonarLintFileAndDoesNotContainAnalyzerParameters_DoesNotPopulateProperties()
public void SetParameterValues_SonarLintFileWithoutRuleParameters_DoesNotPopulateProperties()
{
// Arrange
var compilation = CreateCompilationWithOption("ResourceTests\\SonarLintXml\\All_properties_cs\\SonarLint.xml");
Expand Down Expand Up @@ -181,11 +181,11 @@ public void SetParameterValues_WithMalformedXml_DoesNotPopulateProperties(string
}

[TestMethod]
public void SetParameterValues_WithWrongPropertyType_StringInsteadOfInt_DoesNotPopulateProperties()
public void SetParameterValues_SonarLintFileWithStringInsteadOfIntParameterType_PopulatesProperty()
{
// Arrange
var parameterValue = "fooBar";
var filePath = GenerateSonarLintWithParametrizedRule("S1067", "max", parameterValue);
var filePath = GenerateSonarLintXmlWithParametrizedRule("S1067", "max", parameterValue);
var compilation = CreateCompilationWithOption(filePath);
var analyzer = new ExpressionComplexity(); // Cannot use mock because we use reflection to find properties.

Expand All @@ -197,11 +197,11 @@ public void SetParameterValues_WithWrongPropertyType_StringInsteadOfInt_DoesNotP
}

[TestMethod]
public void SetParameterValues_WithWrongPropertyType_StringInsteadOfBoolean_DoesNotPopulateProperties()
public void SetParameterValues_SonarLintFileWithStringInsteadOfBooleanParameterType_PopulatesProperty()
{
// Arrange
var parameterValue = "fooBar";
var filePath = GenerateSonarLintWithParametrizedRule("S1451", "isRegularExpression", parameterValue);
var filePath = GenerateSonarLintXmlWithParametrizedRule("S1451", "isRegularExpression", parameterValue);
var compilation = CreateCompilationWithOption(filePath);
var analyzer = new CheckFileLicense(); // Cannot use mock because we use reflection to find properties.

Expand All @@ -221,7 +221,7 @@ private static SonarCompilationReportingContext CreateCompilationWithOption(stri
var compilationContext = new CompilationAnalysisContext(compilation, options, _ => { }, _ => true, default);
return new(AnalysisScaffolding.CreateSonarAnalysisContext(), compilationContext);
}
private string GenerateSonarLintWithParametrizedRule(string ruleId, string key, string value)
private string GenerateSonarLintXmlWithParametrizedRule(string ruleId, string key, string value)
{
var ruleParameters = new List<SonarLintXmlRule>()
{
Expand Down

0 comments on commit 645d6dd

Please sign in to comment.