public void NodeCountGet() { TagDocument target = new TagDocument("This is a test"); target._nodeCount = 5; Assert.AreEqual(5, target.NodeCount); }
public HtmlElement CreateElement(string html) { _tagIndeces.Clear(); _firstInvalidNode = null; _htmlSource = html; _htmlElementStack = new Stack <HtmlElement>(); _htmlElementStack.Push(null); Parser parser = new Parser(); parser.IgnoreCase = true; TagDocument tagDocument = parser.Parse(html, 0, false); if (tagDocument.Nodes.Count > 1) { throw new WebTestException("More than one root element is not allowed in the source html when building an HtmlElement."); } HtmlElement newElement = GenerateHtmlElement((NodeContainer)tagDocument.Nodes[0]); if (_ensureValidMarkup && parser.HasInvalidMarkup) { throw new WebTestException(String.Format("The parsed html source has invalid markup at start position {0}.", _firstInvalidNode.StartPosition)); } return(newElement); }
public void DocumentGet() { Node target = CreateNode(); Assert.IsNull(target.Document); TagDocument doc = new TagDocument("This is a test"); target.SetParent(doc); Assert.AreEqual("This is a test", target.Document.Text); }
public void TypeGet() { TagDocument target = new TagDocument(string.Empty); Assert.AreEqual(NodeType.Document, target.Type); }
public void DocumentGet() { TagDocument target = new TagDocument("This is a test"); Assert.AreEqual(target, target.Document); }
public void TextGet() { TagDocument target = new TagDocument("This is a test"); Assert.AreEqual("This is a test", target.Text); }