Esempio n. 1
0
        public void AppendComplexText()
        {
            var text   = "abc";
            var head   = new SimpleText(text, 0, 1);
            var tail   = new ComplexText(new[] { new SimpleText(text, 2, 1) });
            var result = head.AppendComplexText(tail);

            Assert.IsTrue(result == "ac");
            Assert.IsFalse(result is SimpleText);

            text   = "abc";
            head   = new SimpleText(text, 0, 2);
            tail   = new ComplexText(new[] { new SimpleText(text, 1, 2) });
            result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "abbc");
            Assert.IsFalse(result is SimpleText);

            text   = "abc";
            head   = new SimpleText(text, 0, 1);
            tail   = new ComplexText(new[] { new SimpleText(text, 1, 2) });
            result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "abc");
            Assert.IsTrue(result is SimpleText);

            text   = "abc";
            head   = new SimpleText(text, 0, 2);
            tail   = new ComplexText(new[] { new SimpleText(text, 2, 1) });
            result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "abc");
            Assert.IsTrue(result is SimpleText);
        }
        public void AppendComplexText()
        {
            var text = "abc";
            var head = new SimpleText(text, 0, 1);
            var tail = new ComplexText(new[] { new SimpleText(text, 2, 1) });
            var result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "ac");
            Assert.IsFalse(result is SimpleText);

            text = "abc";
            head = new SimpleText(text, 0, 2);
            tail = new ComplexText(new[] { new SimpleText(text, 1, 2) });
            result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "abbc");
            Assert.IsFalse(result is SimpleText);

            text = "abc";
            head = new SimpleText(text, 0, 1);
            tail = new ComplexText(new[] { new SimpleText(text, 1, 2) });
            result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "abc");
            Assert.IsTrue(result is SimpleText);

            text = "abc";
            head = new SimpleText(text, 0, 2);
            tail = new ComplexText(new[] { new SimpleText(text, 2, 1) });
            result = head.AppendComplexText(tail);
            Assert.IsTrue(result == "abc");
            Assert.IsTrue(result is SimpleText);
        }