Exemple #1
0
        public void AsBaseNodeReturnsTheSameNode()
        {
            var tree     = HtmlTree.Create(DocumentFragment(Element("div")));
            var div      = tree.FirstChild.Value;
            var baseNode = div.AsBaseNode();

            Assert.Same(div.Node, baseNode.Node);
            Assert.Same(tree.Node, baseNode.Parent.Value.Node);
        }
Exemple #2
0
        public void CastReturnsTheSameNodeTyped()
        {
            HtmlElement htmlElement;
            var         tree        = HtmlTree.Create(DocumentFragment(htmlElement = Element("div")));
            var         treeElement = tree.FirstChild.Value.Cast <HtmlElement>();

            Assert.Same(htmlElement, treeElement.Node);
            Assert.Same(tree.Node, treeElement.Parent.Value.Node);
        }
Exemple #3
0
 public void AsWithWrongTypeThrowsInvalidCastException() =>
 Assert.Throws <InvalidCastException>(() =>
                                      HtmlTree.Create(Element("div")).As <HtmlDocument>());