示例#1
0
        public void GetText_WithItalicChild_ShouldReturnRightTextWithTags()
        {
            var bold   = new BoldNode();
            var italic = new ItalicNode();

            bold.AddNode(italic);
            bold.AddNode(new PlainTextNode(Text1));
            italic.AddNode(new PlainTextNode(Text2));

            var actual = bold.GetText();

            actual.Should().BeEquivalentTo($"<strong><em>{Text2}</em>{Text1}</strong>");
        }
示例#2
0
        public void GetText_WithoutItalicParent_ShouldReturnJoinedTextOfAllChildrenInStrongTag()
        {
            var plainText1 = new PlainTextNode(Text1);
            var plainText2 = new PlainTextNode(Text2);
            var bold       = new BoldNode();

            bold.AddNode(plainText1);
            bold.AddNode(plainText2);

            var actual = bold.GetText();

            actual.Should().BeEquivalentTo($"<strong>{Text1}{Text2}</strong>");
        }
示例#3
0
        public void GetText_WithItalicParent_ShouldReturnJoinedTextOfAllChildren()
        {
            var italic     = new ItalicNode();
            var plainText1 = new PlainTextNode(Text1);
            var plainText2 = new PlainTextNode(Text2);
            var bold       = new BoldNode();

            bold.AddNode(plainText1);
            bold.AddNode(plainText2);
            italic.AddNode(bold);

            var actual = bold.GetText();

            actual.Should().BeEquivalentTo(Text1 + Text2);
        }
示例#4
0
        public void GetText_ShouldReturnJoinedTextsOfAllChildren()
        {
            var root   = new RootNode();
            var bold   = new BoldNode();
            var italic = new ItalicNode();
            var plain  = new PlainTextNode("Text");

            bold.AddNode(new PlainTextNode("Bold"));
            italic.AddNode(new PlainTextNode("Italic"));
            root.AddNode(plain);
            root.AddNode(bold);
            root.AddNode(italic);

            var actual = root.GetText();

            actual.Should().BeEquivalentTo($"{plain.GetText()}{bold.GetText()}{italic.GetText()}");
        }