예제 #1
0
        public void ToString_with_non_ansi_omits_ANSI_codes()
        {
            var span = new TextSpanFormatter().ParseToSpan(
                $"one{ForegroundColorSpan.Red()}two{ForegroundColorSpan.Reset()}three"
                );

            span.ToString(OutputMode.NonAnsi).Should().Be("onetwothree");
        }
        public void ToString_with_ansi_includes_ANSI_codes()
        {
            var span = new TextSpanFormatter()
                       .ParseToSpan($"one{ForegroundColorSpan.Red()}two{ForegroundColorSpan.Reset()}three");

            span.ToString(OutputMode.Ansi)
            .Should()
            .Be($"one{Ansi.Color.Foreground.Red.EscapeSequence}two{Ansi.Color.Foreground.Default.EscapeSequence}three");
        }