public virtual void SetAnnotationWithoutPageTest()
 {
     NUnit.Framework.Assert.That(() => {
         using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
             document.AddNewPage();
             PdfFileAttachmentAnnotation annotation = new PdfFileAttachmentAnnotation(new Rectangle(0, 0, 20, 20));
             PdfTarget target = PdfTarget.Create(new PdfDictionary());
             target.SetAnnotation(annotation, document);
         }
     }
                                 , NUnit.Framework.Throws.InstanceOf <PdfException>().With.Message.EqualTo(PdfException.AnnotationShallHaveReferenceToPage))
     ;
 }
 public virtual void GetAnnotationSetAsAnnotationTest()
 {
     using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
         PdfFileAttachmentAnnotation annotation = new PdfFileAttachmentAnnotation(new Rectangle(0, 0, 20, 20));
         document.AddNewPage();
         document.GetPage(1).AddAnnotation(annotation);
         PdfDictionary content = new PdfDictionary();
         content.Put(new PdfName("Key"), new PdfString("Value"));
         PdfTarget target = PdfTarget.Create(new PdfDictionary());
         target.SetAnnotation(annotation, document);
         NUnit.Framework.Assert.AreEqual(annotation.GetPdfObject(), target.GetAnnotation(document).GetPdfObject());
     }
 }
 public virtual void SetAnnotationTest()
 {
     using (PdfDocument document = new PdfDocument(new PdfWriter(new MemoryStream()))) {
         PdfFileAttachmentAnnotation annotation0 = new PdfFileAttachmentAnnotation(new Rectangle(0, 0, 20, 20));
         PdfFileAttachmentAnnotation annotation1 = new PdfFileAttachmentAnnotation(new Rectangle(1, 1, 21, 21));
         PdfFileAttachmentAnnotation annotation2 = new PdfFileAttachmentAnnotation(new Rectangle(2, 2, 22, 22));
         document.AddNewPage();
         document.GetPage(1).AddAnnotation(annotation0);
         document.GetPage(1).AddAnnotation(annotation1);
         document.GetPage(1).AddAnnotation(annotation2);
         PdfTarget target = PdfTarget.Create(new PdfDictionary());
         target.SetAnnotation(annotation2, document);
         PdfDictionary dictionary = target.GetPdfObject();
         NUnit.Framework.Assert.AreEqual(0, dictionary.GetAsNumber(PdfName.P).IntValue());
         NUnit.Framework.Assert.AreEqual(2, dictionary.GetAsNumber(PdfName.A).IntValue());
     }
 }