Example #1
0
        public void NodeValue_equals_text()
        {
            DomDocument doc     = new DomDocument();
            var         comment = doc.CreateComment("hello");

            Assert.Equal("hello", comment.NodeValue);
        }
Example #2
0
        public void NodeName_equals_attribute_name()
        {
            var doc     = new DomDocument();
            var comment = doc.CreateComment("");

            Assert.Equal("#comment", comment.NodeName);
        }
 public void test_append_multiple_noncontent_nodes()
 {
     DomDocument doc = new DomDocument();
     var docType = doc.CreateDocumentType("html");
     var ws = doc.CreateComment("time");
     var html = doc.CreateElement("html");
     doc.Append(docType, ws, html);
     Assert.That(doc.DocumentElement, Is.SameAs(html));
     Assert.That(doc.ChildNodes.Count, Is.EqualTo(3));
 }
Example #4
0
        public void Append_should_append_multiple_noncontent_nodes()
        {
            DomDocument doc     = new DomDocument();
            var         docType = doc.CreateDocumentType("html");
            var         ws      = doc.CreateComment("time");
            var         html    = doc.CreateElement("html");

            doc.Append(docType, ws, html);
            Assert.Same(html, doc.DocumentElement);
            Assert.Equal(3, doc.ChildNodes.Count);
        }
        /// <summary>
        /// Appends a comment to document root.
        /// </summary>
        ///
        /// <param name="comment">
        /// The comment.
        /// </param>

        override protected void AppendCommentToDocument(String comment)
        {
            Document.AppendChildUnsafe(Document.CreateComment(comment));
        }