Example #1
0
        public void WritesToStandardStreams()
        {
            var testConsole = new TestConsole();
            var reporter    = new ConsoleReporter(testConsole, verbose: true, quiet: false);

            // stdout
            reporter.Verbose("verbose");
            Assert.Equal("verbose" + EOL, testConsole.GetOutput());
            testConsole.Clear();

            reporter.Output("out");
            Assert.Equal("out" + EOL, testConsole.GetOutput());
            testConsole.Clear();

            reporter.Warn("warn");
            Assert.Equal("warn" + EOL, testConsole.GetOutput());
            testConsole.Clear();

            // stderr
            reporter.Error("error");
            Assert.Equal("error" + EOL, testConsole.GetError());
            testConsole.Clear();
        }
Example #2
0
        public void WritesToStandardStreamsWithCustomEmojis(bool suppressEmojis)
        {
            var testConsole = new TestConsole();
            var reporter    = new ConsoleReporter(testConsole, verbose: true, quiet: false, suppressEmojis: suppressEmojis);
            var dotnetWatchDefaultPrefix = $"dotnet watch {(suppressEmojis ? ":" : "😄")}";

            // stdout
            reporter.Verbose("verbose", emoji: "😄");
            Assert.Equal($"{dotnetWatchDefaultPrefix} verbose" + EOL, testConsole.GetOutput());
            testConsole.Clear();

            reporter.Output("out", emoji: "😄");
            Assert.Equal($"{dotnetWatchDefaultPrefix} out" + EOL, testConsole.GetOutput());
            testConsole.Clear();

            reporter.Warn("warn", emoji: "😄");
            Assert.Equal($"{dotnetWatchDefaultPrefix} warn" + EOL, testConsole.GetOutput());
            testConsole.Clear();

            // stderr
            reporter.Error("error", emoji: "😄");
            Assert.Equal($"{dotnetWatchDefaultPrefix} error" + EOL, testConsole.GetError());
            testConsole.Clear();
        }