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());
 }
        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
 /// <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
 /// <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
 /// 
 /// <param name="tableOfContents"></param>
 public void setTableOfContents(TableOfContents tableOfContents)
 {
     this.tableOfContents = tableOfContents;
 }
예제 #6
0
 /// 
 /// <param name="tableOfContents"></param>
 public void setTableOfContents(TableOfContents tableOfContents)
 {
     this.tableOfContents = tableOfContents;
 }
 public void testCalculateDepth_simple2()
 {
     TableOfContents tableOfContents = new TableOfContents();
     tableOfContents.addTOCReference(new TOCReference());
     Assert.AreEqual(1, tableOfContents.calculateDepth());
 }
 public void testCalculateDepth_simple1()
 {
     TableOfContents tableOfContents = new TableOfContents();
     Assert.AreEqual(0, tableOfContents.calculateDepth());
 }
        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());
        }