Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default progress indicator #2234

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/vstest.console/Internal/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ internal class ConsoleLogger : ITestLoggerWithParameters
internal static bool AppendPrefix;

/// <summary>
/// Bool to decide whether progress indicator should be disabled.
/// Bool to decide whether progress indicator should be enabled.
/// </summary>
internal static bool DisableProgress;
internal static bool EnableProgress;

/// <summary>
/// Uri used to uniquely identify the console logger.
Expand All @@ -83,7 +83,7 @@ internal class ConsoleLogger : ITestLoggerWithParameters
/// <summary>
/// Parameter for disabling progress
/// </summary>
public const string NoProgressParam = "noprogress";
public const string ProgressIndicatorParam = "progress";

#endregion

Expand Down Expand Up @@ -176,7 +176,7 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory)
ConsoleLogger.Output = ConsoleOutput.Instance;
}

if (this.progressIndicator == null && !Console.IsOutputRedirected && !DisableProgress)
if (this.progressIndicator == null && !Console.IsOutputRedirected && EnableProgress)
{
// Progress indicator needs to be displayed only for cli experience.
this.progressIndicator = new ProgressIndicator(Output, new ConsoleHelper());
Expand Down Expand Up @@ -219,10 +219,10 @@ public void Initialize(TestLoggerEvents events, Dictionary<string, string> param
bool.TryParse(prefix, out AppendPrefix);
}

var noprogressExists = parameters.TryGetValue(ConsoleLogger.NoProgressParam, out string noprogress);
if (noprogressExists)
var progressArgExists = parameters.TryGetValue(ConsoleLogger.ProgressIndicatorParam, out string enableProgress);
if (progressArgExists)
{
bool.TryParse(noprogress, out DisableProgress);
bool.TryParse(enableProgress, out EnableProgress);
}

Initialize(events, String.Empty);
Expand Down
8 changes: 4 additions & 4 deletions test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ public void InitializeWithParametersShouldSetNoProgress()
{
var parameters = new Dictionary<string, string>();

Assert.IsFalse(ConsoleLogger.DisableProgress);
Assert.IsFalse(ConsoleLogger.EnableProgress);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert takes care of the default case.


parameters.Add("noprogress", "true");
parameters.Add("progress", "true");
this.consoleLogger.Initialize(new Mock<TestLoggerEvents>().Object, parameters);

Assert.IsTrue(ConsoleLogger.DisableProgress);
Assert.IsTrue(ConsoleLogger.EnableProgress);

ConsoleLogger.DisableProgress = false;
ConsoleLogger.EnableProgress = false;
}

[TestMethod]
Expand Down