public static void GetMaximumSupportedColorMode_WhenColortermPresent_ReturnsBasic() { var newEnv = new Mock <IEnvironmentVariableProvider>(); newEnv.Setup(env => env.HasEnvironmentVariable("COLORTERM")).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Basic, result); }
public static void GetMaximumSupportedColorMode_WhenCIVariableIsTravis_ReturnsBasic() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var ciVar = "Travis"; newEnv.Setup(env => env.TryGetEnvironmentVariable("CI", out ciVar)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Basic, result); }
public static void GetMaximumSupportedColorMode_WhenTermPresentWithScreen256ColorValue_ReturnsEnhanced() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var term = "screen-256color"; newEnv.Setup(env => env.TryGetEnvironmentVariable("TERM", out term)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Enhanced, result); }
public static void GetMaximumSupportedColorMode_WhenTermPresentWithDumbValue_ReturnsBasic() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var term = "dumb"; newEnv.Setup(env => env.TryGetEnvironmentVariable("TERM", out term)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.None, result); }
public static void GetMaximumSupportedColorMode_WhenTermProgramPresentWithAppleTerminal_ReturnsFull() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var termProgram = "Apple_Terminal"; newEnv.Setup(env => env.TryGetEnvironmentVariable("TERM_PROGRAM", out termProgram)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Enhanced, result); }
public static void GetMaximumSupportedColorMode_WhenNotConEmuANSIPresent_ReturnsBasic() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var conemuVar = "xyz"; newEnv.Setup(env => env.TryGetEnvironmentVariable("ConEmuANSI", out conemuVar)).Returns(false); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(WindowsConsole.MaximumSupportedColorLevel, result); }
public static void GetMaximumSupportedColorMode_WhenConEmuANSIPresentAndON_ReturnsEnhanced() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var conemuVar = "ON"; newEnv.Setup(env => env.TryGetEnvironmentVariable("ConEmuANSI", out conemuVar)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Enhanced, result); }
public static void GetMaximumSupportedColorMode_WhenTeamCityVariablePresentWithBadData_ReturnsNone() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var tcVersionVar = "xyz"; newEnv.Setup(env => env.TryGetEnvironmentVariable("TEAMCITY_VERSION", out tcVersionVar)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.None, result); }
public static void GetMaximumSupportedColorMode_WhenCIVariablePresentWithUnknownCI_ReturnsNone() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var ciVar = string.Empty; newEnv.Setup(env => env.TryGetEnvironmentVariable("CI", out ciVar)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.None, result); }
public static void GetMaximumSupportedColorMode_WhenCircleCiVariablePresent_ReturnsBasic() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var ciVar = string.Empty; newEnv.Setup(env => env.TryGetEnvironmentVariable("CI", out ciVar)).Returns(true); newEnv.Setup(env => env.HasEnvironmentVariable("CIRCLECI")).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Basic, result); }
public static void GetMaximumSupportedColorMode_WhenNoVariablesPresent_ReturnsNone() { var newEnv = new Mock <IEnvironmentVariableProvider>(); string tmp; newEnv.Setup(env => env.HasEnvironmentVariable(It.IsAny <string>())).Returns(false); newEnv.Setup(env => env.TryGetEnvironmentVariable(It.IsAny <string>(), out tmp)).Returns(false); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.None, result); }
public static void GetMaximumSupportedColorMode_WhenTermProgramPresentWithiTermAndJunkVersion_ReturnsEnhanced() { var newEnv = new Mock <IEnvironmentVariableProvider>(); var termProgram = "iTerm.app"; var termProgramVersion = "xyz"; newEnv.Setup(env => env.TryGetEnvironmentVariable("TERM_PROGRAM", out termProgram)).Returns(true); newEnv.Setup(env => env.TryGetEnvironmentVariable("TERM_PROGRAM_VERSION", out termProgramVersion)).Returns(true); FabulousConsole.Environment = newEnv.Object; var result = FabulousConsole.GetMaximumSupportedColorMode(); Assert.AreEqual(ConsoleColorMode.Enhanced, result); }
private static void Main() { FabulousConsole.ColorLevel = FabulousConsole.GetMaximumSupportedColorMode(); var a1 = Fabulous .Red .BgHex("#00f") .Underline .Reset .Text("abc"); var a2 = Fabulous.Yellow.Text("def"); var a3 = Fabulous .Black .BgWhiteBright .Strikethrough .Text("ghi"); Fabulous.WriteLine(a1 + a2 + a3); Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(true); }