From fa629d217b154ca729547d16249738d2ac3e9fbc Mon Sep 17 00:00:00 2001 From: nohwnd Date: Thu, 9 Jan 2020 15:06:54 +0100 Subject: [PATCH] Make --verbosity case insensitive Fixes #2179 --- .../Tasks/VSTestTask.cs | 4 ++-- .../VsTestTaskTests.cs | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs b/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs index 79194db9ca..2a07c3af5a 100644 --- a/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs +++ b/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs @@ -247,11 +247,11 @@ private List AddArgs() var quietTestLogging = new List() {"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"; } diff --git a/test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs b/test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs index 24613edf9f..8bdc6d282d 100644 --- a/test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs +++ b/test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs @@ -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() {