Esempio n. 1
0
        public static void ToAnsiString_GivenTextWithStyling_ReturnsCorrectValue()
        {
            const string message  = "this is an important test";
            var          expected = $"\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m\x1B[1m\x1B[4m{ message }\x1B[39m\x1B[49m\x1B[22m\x1B[24m";

            var text    = Fabulous.White.BgBlack.Bold.Underline.Text(message);
            var builder = new AnsiFullStringBuilder(text);
            var result  = builder.ToAnsiString();

            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        public static void ToAnsiString_GivenOnlyFgAndBgColors_ReturnsCorrectValue()
        {
            const string message  = "this is a test";
            var          expected = $"\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m{ message }\x1B[39m\x1B[49m";

            var text    = Fabulous.White.BgBlack.Text(message);
            var builder = new AnsiFullStringBuilder(text);
            var result  = builder.ToAnsiString();

            Assert.AreEqual(expected, result);
        }