public void WriteHighlighted() { Console.BackgroundColor = ConsoleColor.Gray; TConsole.WriteColored(ConsoleColor.Red, "Hello, world!"); Assert.AreEqual(ConsoleColor.Gray, Console.BackgroundColor); TConsole.WriteColored(ConsoleColor.Blue, "Test {0} {2} {1}", "Alpha", "Beta", "Gamma"); Assert.AreEqual(ConsoleColor.Gray, Console.BackgroundColor); var actual = captureOut.ToString(); var expected = "Hello, world!Test Alpha Gamma Beta"; Assert.AreEqual(expected, actual); }
public void Mutex() { var tasks = new Task[] { new Task(() => TConsole.WriteBlock("{0}{1}", "Code Of", "Honor")), new Task(() => TConsole.WriteBlockColored(ConsoleColor.DarkYellow, "{0}{1}", "The Best", "Of Both Worlds")), new Task(() => TConsole.WriteColored(ConsoleColor.Blue, "{0}{1}", "The Master", "piece Society")), new Task(() => TConsole.WriteColored(ConsoleColor.Red, ConsoleColor.Green, "{0}{1}", "Encounter At", "Farpoint")), new Task(() => TConsole.WriteLineColored(ConsoleColor.Cyan, "{0}{1}", "Q", "Who?")), new Task(() => TConsole.WriteLineColored(ConsoleColor.Black, ConsoleColor.DarkGray, "{0}{1}", "The Measure", "Of A Man")), new Task(() => TConsole.WriteBlock("{0}{1}", "Code of", "Honor")), }; }
public void WriteColored_Both() { Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = ConsoleColor.White; TConsole.WriteColored(ConsoleColor.Red, ConsoleColor.Green, "Hello, world!"); Assert.AreEqual(ConsoleColor.Green, Console.ForegroundColor); Assert.AreEqual(ConsoleColor.White, Console.BackgroundColor); TConsole.WriteColored(ConsoleColor.Blue, ConsoleColor.Yellow, "Test {0} {2} {1}", "Alpha", "Beta", "Gamma"); Assert.AreEqual(ConsoleColor.Green, Console.ForegroundColor); Assert.AreEqual(ConsoleColor.White, Console.BackgroundColor); var actual = captureOut.ToString(); var expected = "Hello, world!Test Alpha Gamma Beta"; Assert.AreEqual(expected, actual); }