コード例 #1
0
 public void testAddResource1()
 {
     Resource resource = new Resource("foo");
     TableOfContents toc = new TableOfContents();
     TOCReference tocReference = toc.addSection(resource, "apple/pear", "/");
     Assert.IsNotNull(tocReference);
     Assert.IsNotNull(tocReference.getResource());
     Assert.AreEqual(2, toc.size());
     Assert.AreEqual("pear", tocReference.getTitle());
 }
コード例 #2
0
        public void testAddResourceWithIndexes()
        {
            Resource resource = new Resource("foo");
            TableOfContents toc = new TableOfContents();
            TOCReference tocReference = toc.addSection(resource, new int[] { 0, 0 }, "Section ", ".");

            // check newly created TOCReference
            Assert.IsNotNull(tocReference);
            Assert.IsNotNull(tocReference.getResource());
            Assert.AreEqual("Section 1.1", tocReference.getTitle());

            // check table of contents
            Assert.AreEqual(1, toc.getTocReferences().Count);
            Assert.AreEqual(1, toc.getTocReferences()[0].getChildren().Count);
            Assert.AreEqual(2, toc.size());
            Assert.AreEqual("Section 1", toc.getTocReferences()[0].getTitle());
            Assert.AreEqual("Section 1.1", toc.getTocReferences()[0].getChildren()[0].getTitle());
            Assert.AreEqual(1, toc.getTocReferences()[0].getChildren().Count);
        }
コード例 #3
0
ファイル: Spine.cs プロジェクト: pottereric/EpubLib-Sharp
 /// <summary>
 /// Creates a spine out of all the resources in the table of contents.
 /// </summary>
 /// <param name="tableOfContents">tableOfContents</param>
 public Spine(TableOfContents tableOfContents)
 {
     this.spineReferences = createSpineReferences(tableOfContents.getAllUniqueResources());
 }
コード例 #4
0
ファイル: Spine.cs プロジェクト: lanfengqi/EpubLib-Sharp
 /// <summary>
 /// Creates a spine out of all the resources in the table of contents.
 /// </summary>
 /// <param name="tableOfContents">tableOfContents</param>
 public Spine(TableOfContents tableOfContents)
 {
     this.spineReferences = createSpineReferences(tableOfContents.getAllUniqueResources());
 }
コード例 #5
0
ファイル: Book.cs プロジェクト: lanfengqi/EpubLib-Sharp
 /// 
 /// <param name="tableOfContents"></param>
 public void setTableOfContents(TableOfContents tableOfContents)
 {
     this.tableOfContents = tableOfContents;
 }
コード例 #6
0
ファイル: Book.cs プロジェクト: pottereric/EpubLib-Sharp
 /// 
 /// <param name="tableOfContents"></param>
 public void setTableOfContents(TableOfContents tableOfContents)
 {
     this.tableOfContents = tableOfContents;
 }
コード例 #7
0
 public void testCalculateDepth_simple2()
 {
     TableOfContents tableOfContents = new TableOfContents();
     tableOfContents.addTOCReference(new TOCReference());
     Assert.AreEqual(1, tableOfContents.calculateDepth());
 }
コード例 #8
0
 public void testCalculateDepth_simple1()
 {
     TableOfContents tableOfContents = new TableOfContents();
     Assert.AreEqual(0, tableOfContents.calculateDepth());
 }
コード例 #9
0
        public void testCalculateDepth_simple3()
        {
            TableOfContents tableOfContents = new TableOfContents();
            tableOfContents.addTOCReference(new TOCReference());
            TOCReference childTOCReference = tableOfContents.addTOCReference(new TOCReference());
            childTOCReference.addChildSection(new TOCReference());
            tableOfContents.addTOCReference(new TOCReference());

            Assert.AreEqual(2, tableOfContents.calculateDepth());
        }