public void ParsesFormattedXml_nonXml_returnsOriginalString()
        {
            MarkedUpText parsed = MarkedUpText.ParseXml("An elephant walked into a bar.");

            Assert.That(parsed.Count, Is.EqualTo(1));
            AssertHasFormatting(parsed.GetRun(0), "An elephant walked into a bar.", bolded: false, italicized: false, superscripted: false, underlined: false);
        }
        [TestCase("<p>Some <span>text</span></p>", "Some text")]         // span without class caused problems at one point
        public void ParsesFormattedXmlSpecialCases(string input, string expected)
        {
            var xmlresult = MarkedUpText.ParseXml(input);
            var result    = xmlresult.PlainText();

            Assert.That(result, Is.EqualTo(expected));
        }
        public void ParsesFormattedXmlNested()
        {
            MarkedUpText parsed = MarkedUpText.ParseXml("<p><strong>Bertha and <sup>Bessy</sup></strong><sup><u>sunk</u></sup><u>under</u> the water.</p>");

            Assert.That(parsed.Count, Is.EqualTo(5));
            AssertHasFormatting(parsed.GetRun(0), "Bertha and ", bolded: true, italicized: false, superscripted: false, underlined: false);
            AssertHasFormatting(parsed.GetRun(1), "Bessy", bolded: true, italicized: false, superscripted: true, underlined: false);
            AssertHasFormatting(parsed.GetRun(2), "sunk", bolded: false, italicized: false, superscripted: true, underlined: true);
            AssertHasFormatting(parsed.GetRun(3), "under", bolded: false, italicized: false, superscripted: false, underlined: true);
            AssertHasFormatting(parsed.GetRun(4), " the water.", bolded: false, italicized: false, superscripted: false, underlined: false);
        }
        public void ParsesFormattedXmlVeryNested()
        {
            MarkedUpText parsed = MarkedUpText.ParseXml("<p>  <u><strong><sup>b</sup></strong><em>c</em><strong>d</strong></u>e<u>f</u></p>");

            Assert.That(parsed.Count, Is.EqualTo(6));
            AssertHasFormatting(parsed.GetRun(0), "  ", bolded: false, italicized: false, superscripted: false, underlined: false);
            AssertHasFormatting(parsed.GetRun(1), "b", bolded: true, italicized: false, superscripted: true, underlined: true);
            AssertHasFormatting(parsed.GetRun(2), "c", bolded: false, italicized: true, superscripted: false, underlined: true);
            AssertHasFormatting(parsed.GetRun(3), "d", bolded: true, italicized: false, superscripted: false, underlined: true);
            AssertHasFormatting(parsed.GetRun(4), "e", bolded: false, italicized: false, superscripted: false, underlined: false);
            AssertHasFormatting(parsed.GetRun(5), "f", bolded: false, italicized: false, superscripted: false, underlined: true);
        }
        public void ParsesFormatttedXmlSimple(string input)
        {
            MarkedUpText parsed1 = MarkedUpText.ParseXml(input);

            Assert.That(parsed1.Count, Is.EqualTo(9));
            AssertHasFormatting(parsed1.GetRun(0), "Bob", bolded: true, italicized: false, superscripted: false, underlined: false);
            AssertHasFormatting(parsed1.GetRun(1), " and", bolded: false, italicized: false, superscripted: false, underlined: false);
            AssertHasFormatting(parsed1.GetRun(2), "Izzy", bolded: false, italicized: true, superscripted: false, underlined: false);
            AssertHasFormatting(parsed1.GetRun(4), "underneath", bolded: false, italicized: false, superscripted: false, underlined: true);
            AssertHasFormatting(parsed1.GetRun(6), "supper", bolded: false, italicized: false, superscripted: true, underlined: false);
            AssertHasFormatting(parsed1.GetRun(8), "everyday.", bolded: true, italicized: true, superscripted: true, underlined: true);
        }
        public void MarkedUpText_ToString_ReturnsDecentXmlString()
        {
            MarkedUpText parsed = MarkedUpText.ParseXml("<p>This <strong>papaya</strong> </p><p>tastes perfect</p><p></p>");

            Assert.That(parsed.ToString(), Is.EqualTo($"<p>This <strong>papaya</strong> </p>{Environment.NewLine}<p>tastes perfect</p>{Environment.NewLine}<p></p>"));
        }