diff --git a/NetAF.Tests/Rendering/Console/Ansi_Tests.cs b/NetAF.Tests/Rendering/Console/Ansi_Tests.cs index 90f5684..deb9692 100644 --- a/NetAF.Tests/Rendering/Console/Ansi_Tests.cs +++ b/NetAF.Tests/Rendering/Console/Ansi_Tests.cs @@ -18,23 +18,23 @@ public void GivenNoColorEnvironmentVariableSetToEmptyString_WhenIsColorSuppresse } [TestMethod] - public void GivenNoColorEnvironmentVariableSetTo0_WhenIsColorSuppressed_ThenReturnFalse() + public void GivenNoColorEnvironmentVariableSetTo0_WhenIsColorSuppressed_ThenReturnTrue() { Environment.SetEnvironmentVariable(Ansi.NO_COLOR, "0"); var result = Ansi.IsColorSuppressed(); - Assert.IsFalse(result); + Assert.IsTrue(result); } [TestMethod] - public void GivenNoColorEnvironmentVariableSetToFalse_WhenIsColorSuppressed_ThenReturnFalse() + public void GivenNoColorEnvironmentVariableSetToFalse_WhenIsColorSuppressed_ThenReturnTrue() { Environment.SetEnvironmentVariable(Ansi.NO_COLOR, "False"); var result = Ansi.IsColorSuppressed(); - Assert.IsFalse(result); + Assert.IsTrue(result); } [TestMethod] diff --git a/NetAF/Rendering/Console/Ansi.cs b/NetAF/Rendering/Console/Ansi.cs index db74315..1b3d1a7 100644 --- a/NetAF/Rendering/Console/Ansi.cs +++ b/NetAF/Rendering/Console/Ansi.cs @@ -31,14 +31,14 @@ public static class Ansi /// /// Determine if color is suppressed. If the NO_COLOR environment variable is present and set to anything other than '0' or 'false' this will return true. /// - /// True if the NO_COLOR environment variable is present and set to anything other than '0' or 'false', else false. + /// True if the NO_COLOR environment variable is present and set to anything other than an empty string, else false. public static bool IsColorSuppressed() { var value = Environment.GetEnvironmentVariable(NO_COLOR)?.ToLower() ?? string.Empty; return value switch { - "" or "0" or "false" => false, + "" => false, _ => true, }; }