Skip to content

Commit

Permalink
Make --verbosity case insensitive (#2300)
Browse files Browse the repository at this point in the history
Fixes #2179
  • Loading branch information
nohwnd committed Jan 20, 2020
1 parent f919e24 commit 51a2b03
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ private List<string> AddArgs()
var quietTestLogging = new List<string>() {"q", "quiet"};

string vsTestVerbosity = "minimal";
if (normalTestLogging.Contains(this.VSTestVerbosity))
if (normalTestLogging.Contains(this.VSTestVerbosity.ToLowerInvariant()))
{
vsTestVerbosity = "normal";
}
else if (quietTestLogging.Contains(this.VSTestVerbosity))
else if (quietTestLogging.Contains(this.VSTestVerbosity.ToLowerInvariant()))
{
vsTestVerbosity = "quiet";
}
Expand Down
20 changes: 20 additions & 0 deletions test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,26 @@ public void CreateArgumentShouldSetConsoleLoggerVerbosityToMinimalIfConsoleLogge
Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=minimal")));
}

[TestMethod]
public void CreateArgumentShouldSetConsoleLoggerVerbosityToNormalIfConsoleLoggerIsNotGivenInArgsAndVerbosityIsNormalWithCapitalN()
{
this.vsTestTask.VSTestVerbosity = "Normal";

var allArguments = this.vsTestTask.CreateArgument().ToArray();

Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=normal")));
}

[TestMethod]
public void CreateArgumentShouldSetConsoleLoggerVerbosityToQuietIfConsoleLoggerIsNotGivenInArgsAndVerbosityIsQuietWithCapitalQ()
{
this.vsTestTask.VSTestVerbosity = "Quiet";

var allArguments = this.vsTestTask.CreateArgument().ToArray();

Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=quiet")));
}

[TestMethod]
public void CreateArgumentShouldPreserveWhiteSpaceInLogger()
{
Expand Down

0 comments on commit 51a2b03

Please sign in to comment.