private static void Log_OnErrorWriteLine(string obj) { using (ConsoleColorResetter reset = new ConsoleColorResetter(ConsoleColor.Red, null)) { Console.Error.Write(obj); } }
private static void Log_OnWarningWriteLine(string obj) { using (ConsoleColorResetter reset = new ConsoleColorResetter(ConsoleColor.Yellow, null)) { Console.Write(obj); } }
public void ForegroundOnlyTest() { const ConsoleColor newFgColor = ConsoleColor.DarkGreen; using (ConsoleColorResetter uut = new ConsoleColorResetter(newFgColor, null)) { Assert.AreEqual(newFgColor, Console.ForegroundColor); Assert.AreEqual(originalBackground, Console.BackgroundColor); } // Should be restored after dispose is called. Assert.AreEqual(originalForeground, Console.ForegroundColor); Assert.AreEqual(originalBackground, Console.BackgroundColor); }