示例#1
0
        public void TestPrettyPrintCover()
        {
            string    xml         = Utils.ReadStringResource("UnitTestMergeWebToEpub.TestData.Cover.xhtml");
            var       fromAgility = HtmlAgilityPackUtils.PrettyPrintXhtml(xml);
            XDocument agilityDoc  = XDocument.Parse(fromAgility);
            XDocument doc         = doc = Encoding.UTF8.GetBytes(xml).ToXhtml();
            var       delta       = XmlCompare.ElementSame(agilityDoc.Root, doc.Root);

            Assert.IsTrue(delta.AreSame);
        }
示例#2
0
 private bool TestPrettyPrint(Epub epub)
 {
     foreach (var item in epub.Opf.Spine)
     {
         XDocument doc         = item.RawBytes.ToXhtml();
         var       xml         = Encoding.UTF8.GetString(item.RawBytes);
         var       fromAgility = HtmlAgilityPackUtils.PrettyPrintXhtml(xml);
         XDocument agilityDoc  = Encoding.UTF8.GetBytes(fromAgility).ToXhtml();
         var       delta       = XmlCompare.ElementSame(agilityDoc.Root, doc.Root);
         if (!delta.AreSame)
         {
             return(false);
         }
     }
     return(true);
 }