| 11 | public class TestHtmlParser |
| 12 | { |
| 13 | [TestCase("")] |
| 14 | [TestCase("a")] |
| 15 | [TestCase("a\na")] |
| 16 | [TestCase("a\ra")] |
| 17 | [TestCase("<a>")] |
| 18 | [TestCase("<a/>")] |
| 19 | [TestCase("<a />")] |
| 20 | [TestCase("<a>b<a/>")] |
| 21 | [TestCase("<!-- -->")] |
| 22 | public void TestValid(string html) |
| 23 | { |
| 24 | var parser = new HtmlParser(html); |
| 25 | while (parser.ParseNext(out var tag)) |
| 26 | { |
| 27 | Assert.IsNotNull(tag.Name); |
| 28 | Assert.IsNotNull(tag.Attributes); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | [TestCase("b<a>b", ExpectedResult = new[] { "a" })] |
| 33 | [TestCase("b<a/>b", ExpectedResult = new[] { "a" })] |