Ejemplo n.º 1
0
        public void AppendingMultipleStringsWithLines()
        {
            var builder = new ColoredMultistringBuilder();

            builder.AppendLine(new ColoredString[] { "Hello, ", "world" });

            builder.ToString().Should().Be("Hello, world" + Environment.NewLine);
        }
Ejemplo n.º 2
0
        public void AppendingMultipleStrings()
        {
            var builder = new ColoredMultistringBuilder();

            builder.Append(new ColoredString[] { "Hello, ", "world" });

            builder.ToString().Should().Be("Hello, world");
        }
Ejemplo n.º 3
0
        public void AppendingMultipleMultistringsWithLines()
        {
            var builder = new ColoredMultistringBuilder();

            builder.AppendLine("Foo");
            builder.AppendLine(CreateCMS(", bar", ", baz!"));

            builder.ToString().Should().Be("Foo" + Environment.NewLine + ", bar, baz!" + Environment.NewLine);
        }
Ejemplo n.º 4
0
        public void AppendingMultipleMultistrings()
        {
            var builder = new ColoredMultistringBuilder();

            builder.Append("Foo");
            builder.Append(CreateCMS(", bar", ", baz!"));

            builder.ToString().Should().Be("Foo, bar, baz!");
        }
Ejemplo n.º 5
0
        public void SimpleUsage()
        {
            var builder = new ColoredMultistringBuilder();

            builder.Append("Hello");
            builder.Append(", world");

            builder.ToString().Should().Be("Hello, world");
        }
        public void TestIterativelyAppendingMultiplePiecesWithSameColorMergesStrings()
        {
            var anyStrings        = anyArrayOfMultipleStrings;
            var mergedString      = string.Join(string.Empty, anyStrings);
            var anyColoredStrings = anyArrayOfMultipleColoredStrings;

            var builder = new ColoredMultistringBuilder();

            foreach (var cs in anyColoredStrings)
            {
                builder.Append(cs);
            }

            builder.Length.Should().Be(mergedString.Length);
            builder.ToString().Should().Be(mergedString);
            builder.ShouldProduce(anyColoredStrings);
        }
        public void TestAppendingOnePieceToEmptyBuilderYieldsBackCopyOfPiece()
        {
            var anyCs = AnyColoredString();

            var builder = new ColoredMultistringBuilder();

            builder.Append(anyCs);

            builder.Length.Should().Be(anyCs.Length);
            builder.ToString().Should().Be(anyCs.ToString());

            var ms = builder.ToMultistring();

            ms.Should().NotBeNull();
            ms.Length.Should().Be(anyCs.Length);
            ms.Content.Should().ContainSingle(anyCs);
        }
        public void TestEmptyBuilderYieldsEmptyString()
        {
            var builder = new ColoredMultistringBuilder();

            builder.ToString().Should().BeEmpty();
        }