public virtual void SortOrderForOneKeyTest()
        {
            String            key           = "testKey";
            bool              testAscending = true;
            PdfCollectionSort sort          = new PdfCollectionSort(key);

            NUnit.Framework.Assert.IsNull(sort.GetPdfObject().Get(PdfName.A));
            sort.SetSortOrder(testAscending);
            NUnit.Framework.Assert.IsTrue(sort.GetPdfObject().GetAsBool(PdfName.A));
        }
        public virtual void SortOrderForMultipleKeysTest()
        {
            String[]          keys           = new String[] { "testKey1", "testKey2", "testKey3" };
            bool[]            testAscendings = new bool[] { true, false, true };
            PdfCollectionSort sort           = new PdfCollectionSort(keys);

            sort.SetSortOrder(testAscendings);
            for (int i = 0; i < testAscendings.Length; i++)
            {
                NUnit.Framework.Assert.AreEqual(testAscendings[i], sort.GetPdfObject().GetAsArray(PdfName.A).GetAsBoolean(
                                                    i).GetValue());
            }
        }
 public virtual void IncorrectMultipleSortOrderForMultipleKeysTest()
 {
     NUnit.Framework.Assert.That(() => {
         String[] keys          = new String[] { "testKey1", "testKey2", "testKey3" };
         bool[] testAscendings  = new bool[] { true, false };
         PdfCollectionSort sort = new PdfCollectionSort(keys);
         // this line will throw an exception as number of parameters of setSortOrder()
         // method should be exactly the same as number of keys of PdfCollectionSort
         // here we have three keys but two params
         sort.SetSortOrder(testAscendings);
     }
                                 , NUnit.Framework.Throws.InstanceOf <PdfException>().With.Message.EqualTo(PdfException.NumberOfBooleansInTheArrayDoesntCorrespondWithTheNumberOfFields))
     ;
 }
 public virtual void SingleSortOrderForMultipleKeysTest()
 {
     NUnit.Framework.Assert.That(() => {
         String[] keys          = new String[] { "testKey1", "testKey2", "testKey3" };
         bool testAscending     = true;
         PdfCollectionSort sort = new PdfCollectionSort(keys);
         // this line will throw an exception as number of parameters of setSortOrder()
         // method should be exactly the same as number of keys of PdfCollectionSort
         // here we have three keys but one param
         sort.SetSortOrder(testAscending);
     }
                                 , NUnit.Framework.Throws.InstanceOf <PdfException>().With.Message.EqualTo(PdfException.YouHaveToDefineABooleanArrayForThisCollectionSortDictionary))
     ;
 }
 public virtual void IncorrectSortOrderForOneKeyTest()
 {
     NUnit.Framework.Assert.That(() => {
         String key             = "testKey";
         bool[] testAscendings  = new bool[] { true, false };
         PdfCollectionSort sort = new PdfCollectionSort(key);
         sort.SetSortOrder(testAscendings);
         // this line will throw an exception as number of parameters of setSortOrder()
         // method should be exactly the same as number of keys of PdfCollectionSort
         // here we have one key but two params
         NUnit.Framework.Assert.IsTrue(sort.GetPdfObject().GetAsBool(PdfName.A));
     }
                                 , NUnit.Framework.Throws.InstanceOf <PdfException>().With.Message.EqualTo(PdfException.YouNeedASingleBooleanForThisCollectionSortDictionary))
     ;
 }