public void MixedAttributes() { string input = "<name attr1=\"value\" attr2 attr3=\'\'>"; TextFormatter formatter = new TextFormatter(input); NormalTagParser parser = new NormalTagParser(formatter); if (parser.CanParse()) { parser.Parse(); } HtmlDocumentNode node = parser.ParsedNode; Assert.AreEqual("name", node.Name); Assert.AreEqual(3, node.Attributes.Count); Assert.AreEqual("attr1", node.Attributes[0].Name); Assert.AreEqual("attr2", node.Attributes[1].Name); Assert.AreEqual("attr3", node.Attributes[2].Name); Assert.AreEqual("value", node.Attributes[0].Value); Assert.AreEqual(null, node.Attributes[1].Value); Assert.AreEqual("", node.Attributes[2].Value); Assert.AreEqual(1, node.Flags.Count); Assert.AreEqual(true, node.Flags.Contains(Flags.NormalTag)); }
public void NormalTag() { string input = "<name>"; TextFormatter formatter = new TextFormatter(input); NormalTagParser parser = new NormalTagParser(formatter); if (parser.CanParse()) { parser.Parse(); } HtmlDocumentNode node = parser.ParsedNode; Assert.AreEqual("name", node.Name); Assert.AreEqual(0, node.Attributes.Count); Assert.AreEqual(1, node.Flags.Count); Assert.AreEqual(true, node.Flags.Contains(Flags.NormalTag)); }
public void AttributesWithQuotesWithoutValues() { string input = "<name attr=\"\" attr2=\'\'>"; TextFormatter formatter = new TextFormatter(input); NormalTagParser parser = new NormalTagParser(formatter); if (parser.CanParse()) { parser.Parse(); } HtmlDocumentNode node = parser.ParsedNode; Assert.AreEqual("name", node.Name); Assert.AreEqual(2, node.Attributes.Count); Assert.AreEqual("attr", node.Attributes[0].Name); Assert.AreEqual("attr2", node.Attributes[1].Name); Assert.AreEqual("", node.Attributes[0].Value); Assert.AreEqual("", node.Attributes[1].Value); Assert.AreEqual(1, node.Flags.Count); Assert.AreEqual(true, node.Flags.Contains(Flags.NormalTag)); }