Ejemplo n.º 1
0
        public EpubCombiner MakeCombiner()
        {
            var combiner = new EpubCombiner(MockEpub1());

            combiner.Add(MockEpub2());
            return(combiner);
        }
Ejemplo n.º 2
0
        public void TestGetMaxPrefix()
        {
            var combiner = new EpubCombiner(MockEpub1());

            combiner.ToAppend = MockEpub2();

            int actual = combiner.InitialEpub.Opf.GetPageItems().GetMaxPrefix();

            Assert.AreEqual(13, actual);
        }
Ejemplo n.º 3
0
        public void TestCopyTableOfContents()
        {
            var combiner = new EpubCombiner(MockEpub1());

            combiner.ToAppend = MockEpub2();

            var initialTocLength = combiner.InitialEpub.ToC.Entries.Count;

            combiner.Combine();
            var newToc = combiner.InitialEpub.ToC.Entries.Skip(initialTocLength).ToList();

            Assert.AreEqual(3, newToc.Count);
            Assert.AreEqual(0, newToc[0].Children.Count);
            Assert.AreEqual("Splash pages", newToc[0].Title);
            Assert.AreEqual("OEPBS/Text/0015_Splash_pages.xhtml", newToc[0].ContentSrc);
            Assert.AreEqual(4, newToc[1].Children.Count);
            Assert.AreEqual("Chapter 2", newToc[1].Children[1].Title);
            Assert.AreEqual("OEPBS/Text/0017_Chapter_2.xhtml", newToc[1].Children[1].ContentSrc);
        }
Ejemplo n.º 4
0
        public void TestAdd_CallMultipleTimes()
        {
            var combiner = new EpubCombiner(MockEpub1());
            var manifest = combiner.InitialEpub.Opf.Manifest;

            Assert.AreEqual(16, manifest.Count);
            Assert.AreEqual(0, combiner.InitialEpub.Opf.GetImageItems().Count());

            var epub2 = MockEpub2();

            combiner.Add(epub2);
            Assert.AreEqual(43, manifest.Count);
            Assert.AreEqual(20, combiner.InitialEpub.Opf.GetImageItems().Count());

            combiner.Add(epub2);
            Assert.AreEqual(50, manifest.Count);
            Assert.AreEqual(20, combiner.InitialEpub.Opf.GetImageItems().Count());
            Assert.AreEqual(20, combiner.ImageHashes.Count);
            Assert.AreEqual("OEPBS/Images/0002_p1alt2en.png", combiner.NewAbsolutePaths["OEPBS/Images/0000_p1alt2en.png"]);
        }