Exemplo n.º 1
0
        public void Test_InnerText()
        {
            var html = @"< p > A < b > regular expression </ b >, < b > regex </ b > or < b > regexp </ b > (sometimes called a<b>rational expression</ b >) is, in < a href = /wiki/Theoretical_computer_science title = Theoretical computer science > theoretical computer science</ a > and < a href = /wiki/Formal_language title = Formal language > formal language </ a > theory, a sequence of < a href = /wiki/Character_(computing) title = Character (computing) > characters </ a > that define a<i>search<a href= /wiki/Pattern_matching title= Pattern matching > pattern </ a ></ i >.Usually this pattern is then used by < a href = /wiki/String_searching_algorithm title = String searching algorithm > string searching algorithms</ a > for find or find and replace operations on < a href = /wiki/String_(computer_science) title = String (computer science) > strings </ a >.</ p >";

            var expected = new List <string> {
                "theoretical computer science", "formal language", "characters", "pattern", "string searching algorithms", "strings"
            };

            Assert.Equal(expected, RegExpr.InnerText(html, "a"));
        }
Exemplo n.º 2
0
        public void Test_InnerTextTagNested()
        {
            var html     = @"<div>
    <p>The phrase <i>regular expressions</i> (and consequently, regexes) is often used to mean the specific, standard textual syntax for representing <u>patterns</u> that matching <em>text</em> need to conform to.</p>
</div> ";
            var expected = new List <string> {
                "The phrase", "regular expressions", "(and consequently, regexes) is often used to mean the specific, standard textual syntax for representing", "patterns", "that matching", "text", "need to conform to."
            };

            Assert.Equal(expected, RegExpr.InnerText(html, "p"));
        }