Example #1
0
        public void FormatTextIntoParagraphs_MultipleLinesAreWrapped()
        {
            var content  = $"This is a single line of text{ Environment.NewLine } This is a second line{ Environment.NewLine} This is a third";
            var expected = $"<p>{ content.Replace(Environment.NewLine, string.Empty) }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #2
0
        public void FormatTextIntoParagraphs_EmbeddedParagraphsAreRecognized()
        {
            var content  = "This is <p>a single</p> line of text";
            var expected = $"<p>This is</p><p>a single</p><p> line of text</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #3
0
        public void FormatTextIntoParagraphs_EmbeddedParagraphsAreRecognizedForMultipleLines()
        {
            var content  = $"This is the<p>first line</p> of text.{ Environment.NewLine } This <p>is the</p> second.";
            var expected = "<p>This is the</p><p>first line</p><p> of text. This</p><p>is the</p><p> second.</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #4
0
        public void FormatTextIntoParagraphs_PartialExistingParagraphsAreRecognizedForMultipleLines()
        {
            var content  = $"This is the first line of text.{ Environment.NewLine } This is the second.</p>";
            var expected = $"<p>{ content.Replace(Environment.NewLine, string.Empty) }";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #5
0
        public void FormatTextIntoParagraphs_LeadingAndTrailingBlanksAreIgnoredForMultipleLines()
        {
            var content  = $"{ Environment.NewLine }{ Environment.NewLine }This is a single line of text{ Environment.NewLine } This is a second line{ Environment.NewLine} This is a third{ Environment.NewLine }{ Environment.NewLine }";
            var expected = $"<p>{ content.Replace(Environment.NewLine, string.Empty) }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #6
0
        public void FormatTextIntoParagraphs_PartialExistingParagraphsAreRecognized()
        {
            var content  = "<p>This is a single line of text";
            var expected = $"{ content }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #7
0
        public void FormatTextIntoParagraphs_ExistingTagsArePreservedForMultipleParagraphs()
        {
            var first    = $"This is the <c>first</c> line.";
            var second   = "A <b><i>second</i> paragraph</b>.";
            var third    = "<code>This is the third paragraph.</code>";
            var content  = $"{ first }{ Environment.NewLine }{ Environment.NewLine }{ second }{ Environment.NewLine }{ Environment.NewLine }{ third }";
            var expected = $"<p>{ first }</p><p>{ second }</p><p>{ third }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #8
0
        public void FormatTextIntoParagraphs_ExtraBlanksAreIgnoredBetwenMultipleParagraphs()
        {
            var first    = $"This is the first line.{ Environment.NewLine } This is a second line.";
            var second   = "A second paragraph.";
            var third    = "This is the third paragraph.";
            var content  = $"{ Environment.NewLine }{ Environment.NewLine }{ first }{ Environment.NewLine }{ Environment.NewLine }{ Environment.NewLine }{ Environment.NewLine }{ second }{ Environment.NewLine }{ Environment.NewLine }{ Environment.NewLine }{ Environment.NewLine }{ third }{ Environment.NewLine }{ Environment.NewLine }";
            var expected = $"<p>{ first.Replace(Environment.NewLine, string.Empty) }</p><p>{ second }</p><p>{ third }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #9
0
        public void FormatTextIntoParagraphs_LineIndentsAreNormalized(string indent)
        {
            var first    = "This is the first line.";
            var second   = "A second line.";
            var third    = "This is the third line.";
            var content  = $"{ indent }{first}{ Environment.NewLine }{ indent }{ second }{ Environment.NewLine }{ third }";
            var expected = $"<p>{ first } { second } { third }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #10
0
        public void FormatTextIntoParagraphs_MultipleParagraphsWithManualParagraphsAreWrapped()
        {
            var first    = $"<p>This is the first line.</p>";
            var second   = "A second paragraph.";
            var third    = "This is the third paragraph.";
            var content  = $"{ first }{ second }{ Environment.NewLine }{ Environment.NewLine }{ third }";
            var expected = $"{ first }<p>{ second }</p><p>{ third }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #11
0
        public void FormatTextIntoParagraphs_EmbeddedParagraphsAreRecognizedForMultipleParagraphs()
        {
            var first    = "<p>This is the first paragraph.";
            var second   = "A <p>second paragraph.</p>";
            var third    = "This <p>is the third</p> paragraph.</p>";
            var content  = $"{ first }{ Environment.NewLine }{ Environment.NewLine }{ second }{ Environment.NewLine }{ Environment.NewLine }{ third }";
            var expected = "<p>This is the first paragraph.</p><p>A</p><p>second paragraph.</p><p>This</p><p>is the third</p><p> paragraph.</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #12
0
        public void FormatTextIntoParagraphs_MultipleLinesSpacesWithMultipleParagraphsAreNormalized()
        {
            var first    = $"This is the first line.{ Environment.NewLine }This is a second line.";
            var second   = $"A second paragraph.{ Environment.NewLine }With a second line.";
            var third    = "This is the third paragraph.";
            var content  = $"{ first }{ Environment.NewLine }{ Environment.NewLine }{ second }{ Environment.NewLine }{ Environment.NewLine }{ third }";
            var expected = $"<p>{ first.Replace(Environment.NewLine, " ") }</p><p>{ second.Replace(Environment.NewLine, " ") }</p><p>{ third }</p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #13
0
        public void FormatTextIntoParagraphs_ParagraphsArePreservedWhenUsedInconsistentlyWithOtherTags()
        {
            var content = @"
            <p>
              Red/Blue/Yellow/Purple can become all color you want.
            </p>
            <ul>
              <li>
                Orange = Red + Yellow
              </li>
              <li>
                Purple = Red + Blue
              </li>
            </ul>";

            var expected = "<p>Red/Blue/Yellow/Purple can become all color you want.</p><p><ul> <li> Orange = Red + Yellow </li> <li> Purple = Red + Blue </li> </ul></p>";

            Assert.AreEqual(expected, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #14
0
        public void FormatTextIntoParagraphs_ExistingTagsArePreserved()
        {
            var content = "This is a <code>single<code> line of text";

            Assert.AreEqual(content, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #15
0
 public void FormatTextIntoParagraphs_EmptyContentIsNotParsed(string content)
 {
     Assert.AreSame(content, ECMALoader.FormatTextIntoParagraphs(content));
 }
Example #16
0
        public void FormatTextIntoParagraphs_ExistingParagraphsAreRecognized()
        {
            var content = "<p>This is a single< line of text</p>";

            Assert.AreEqual(content, ECMALoader.FormatTextIntoParagraphs(content));
        }
Example #17
0
        public void FormatTextIntoParagraphs_SingleLineIsNotWrapped()
        {
            var content = "This is a single line of text";

            Assert.AreEqual(content, ECMALoader.FormatTextIntoParagraphs(content));
        }