コード例 #1
0
        public virtual void CheckNumberOfIndirectObjectsTest()
        {
            PdfXrefTable table = new PdfXrefTable();

            NUnit.Framework.Assert.AreEqual(0, table.GetCountOfIndirectObjects());
            int numberOfReferences = 10;

            for (int i = 0; i < numberOfReferences; i++)
            {
                table.Add(new PdfIndirectReference(null, i + 1));
            }
            NUnit.Framework.Assert.AreEqual(numberOfReferences, table.GetCountOfIndirectObjects());
        }
コード例 #2
0
        public virtual void CheckNumberOfIndirectObjectsWithFreeReferencesTest()
        {
            PdfXrefTable table = new PdfXrefTable();
            int          numberOfReferences = 10;

            for (int i = 0; i < numberOfReferences; i++)
            {
                table.Add(new PdfIndirectReference(null, i + 1));
            }
            table.InitFreeReferencesList(null);
            int freeReferenceNumber = 5;

            table.FreeReference(table.Get(freeReferenceNumber));
            NUnit.Framework.Assert.AreEqual(numberOfReferences - 1, table.GetCountOfIndirectObjects());
            NUnit.Framework.Assert.IsTrue(table.Get(freeReferenceNumber).IsFree());
        }