override public void Execute()
        {
            DocumentPackage package = PackageBuilder.NewPackageNamed(PackageName)
                                      .DescribedAs("This is a document workflow example")
                                      .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                  .WithFirstName("John")
                                                  .WithLastName("Smith"))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("Second Document")
                                                    .FromStream(fileStream1, DocumentType.PDF)
                                                    .AtIndex(2)
                                                    .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                   .OnPage(0)
                                                                   .AtPosition(100, 100)))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                    .FromStream(fileStream2, DocumentType.PDF)
                                                    .AtIndex(1)
                                                    .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                   .OnPage(0)
                                                                   .AtPosition(100, 100)))
                                      .Build();

            packageId = ossClient.CreatePackage(package);

            Console.WriteLine("Package create, id = " + packageId);

            DocumentPackage savedPackage = ossClient.GetPackage(packageId);

            savedPackage.GetDocument("First Document").Index  = 2;
            savedPackage.GetDocument("Second Document").Index = 1;

            ossClient.PackageService.OrderDocuments(savedPackage);

            Console.WriteLine("Document order saved");
        }
예제 #2
0
        public void VerifyResult()
        {
            SignatureStylesExample example = new SignatureStylesExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            foreach (Signature signature in documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures)
            {
                if ((int)(signature.X + 0.1) == example.FULL_NAME_SIGNATURE_POSITION_X && (int)(signature.Y + 0.1) == example.FULL_NAME_SIGNATURE_POSITION_Y)
                {
                    Assert.AreEqual(signature.Style, SignatureStyle.FULL_NAME);
                    Assert.AreEqual(signature.Page, example.FULL_NAME_SIGNATURE_PAGE);
                }
                if ((int)(signature.X + 0.1) == example.INITIAL_SIGNATURE_POSITION_X && (int)(signature.Y + 0.1) == example.INITIAL_SIGNATURE_POSITION_Y)
                {
                    Assert.AreEqual(signature.Style, SignatureStyle.INITIALS);
                    Assert.AreEqual(signature.Page, example.INITIAL_SIGNATURE_PAGE);
                }
                if ((int)(signature.X + 0.1) == example.HAND_DRAWN_SIGNATURE_POSITION_X && (int)(signature.Y + 0.1) == example.HAND_DRAWN_SIGNATURE_POSITION_Y)
                {
                    Assert.AreEqual(signature.Style, SignatureStyle.HAND_DRAWN);
                    Assert.AreEqual(signature.Page, example.HAND_DRAWN_SIGNATURE_PAGE);
                }
            }
        }
예제 #3
0
        public void VerifyResult()
        {
            TextTagsExample example = new TextTagsExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            Document document1 = documentPackage.GetDocument(example.DOCUMENT1_NAME);
            Document document2 = documentPackage.GetDocument(example.DOCUMENT2_NAME);
            Document document3 = documentPackage.GetDocument(example.DOCUMENT3_NAME);

            Assert.AreEqual(2, document1.Signatures.Count);
            Assert.AreEqual(4, document2.Signatures.Count);
            Assert.AreEqual(6, document3.Signatures.Count);
        }
        public void VerifyResult()
        {
            SignerBoundFieldsExample example = new SignerBoundFieldsExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            foreach (Signature signature in documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures)
            {
                foreach (Field field in signature.Fields)
                {
                    if ((int)(field.X + 0.1) == example.SIGNATURE_DATE_POSITION_X && (int)(field.Y + 0.1) == example.SIGNATURE_DATE_POSITION_Y)
                    {
                        Assert.AreEqual(field.Page, example.SIGNATURE_DATE_PAGE);
                        Assert.AreEqual(field.Style, FieldStyle.BOUND_DATE);
                    }
                    if ((int)(field.X + 0.1) == example.SIGNER_COMPANY_POSITION_X && (int)(field.Y + 0.1) == example.SIGNER_COMPANY_POSITION_Y)
                    {
                        Assert.AreEqual(field.Page, example.SIGNER_COMPANY_PAGE);
                        Assert.AreEqual(field.Style, FieldStyle.BOUND_COMPANY);
                    }
                    if ((int)(field.X + 0.1) == example.SIGNER_NAME_POSITION_X && (int)(field.Y + 0.1) == example.SIGNER_NAME_POSITION_Y)
                    {
                        Assert.AreEqual(field.Page, example.SIGNER_NAME_PAGE);
                        Assert.AreEqual(field.Style, FieldStyle.BOUND_NAME);
                    }
                    if ((int)(field.X + 0.1) == example.SIGNER_TITLE_POSITION_X && (int)(field.Y + 0.1) == example.SIGNER_TITLE_POSITION_Y)
                    {
                        Assert.AreEqual(field.Page, example.SIGNER_TITLE_PAGE);
                        Assert.AreEqual(field.Style, FieldStyle.BOUND_TITLE);
                    }
                }
            }
        }
        public void VerifyResult()
        {
            CreatePackageFromTemplateExample example = new CreatePackageFromTemplateExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;
            Document        document        = documentPackage.GetDocument(example.DOCUMENT_NAME);

            Assert.AreEqual(document.Name, example.DOCUMENT_NAME);
            Assert.AreEqual(document.Id, example.DOCUMENT_ID);

            Assert.AreEqual(documentPackage.Name, example.PackageName);
            Assert.AreEqual(documentPackage.Description, example.PACKAGE_DESCRIPTION);
            Assert.AreEqual(documentPackage.EmailMessage, example.PACKAGE_EMAIL_MESSAGE2);

            Assert.AreEqual(documentPackage.Signers.Count, 3);
            Assert.AreEqual(documentPackage.GetSigner(example.email1).FirstName, example.PACKAGE_SIGNER1_FIRST);
            Assert.AreEqual(documentPackage.GetSigner(example.email1).LastName, example.PACKAGE_SIGNER1_LAST);
            Assert.AreEqual(documentPackage.GetSigner(example.email2).FirstName, example.PACKAGE_SIGNER2_FIRST);
            Assert.AreEqual(documentPackage.GetSigner(example.email2).LastName, example.PACKAGE_SIGNER2_LAST);

            // TODO: Make sure that this is correctly preserved.
            Assert.IsFalse(documentPackage.Settings.EnableInPerson.Value);
            Assert.IsFalse(documentPackage.Settings.EnableDecline.Value);
            Assert.IsFalse(documentPackage.Settings.EnableOptOut.Value);
            Assert.IsFalse(documentPackage.Settings.HideWatermark.Value);
        }
예제 #6
0
        public void VerifyResult()
        {
            FieldValidationExample example = new FieldValidationExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            Document document = documentPackage.GetDocument(example.DOCUMENT_NAME);

            foreach (Signature signature in document.Signatures)
            {
                if (!signature.SignerEmail.Equals(example.Email1))
                {
                    break;
                }

                foreach (Field field in signature.Fields)
                {
                    string fieldId = field.Id;

                    if (fieldId.Equals(example.FIELD_ALPHABETIC_ID))
                    {
                        Assert.AreEqual(field.Validator.Regex, ALPHABETIC_REGEX);
                        Assert.AreEqual(field.Validator.MaxLength, example.FIELD_ALPHABETIC_MAX_LENGTH);
                        Assert.AreEqual(field.Validator.MinLength, example.FIELD_ALPHABETIC_MIN_LENGTH);
                        Assert.IsTrue(field.Validator.Required);
                        Assert.AreEqual(field.Validator.Message, example.FIELD_ALPHABETIC_ERROR_MESSAGE);
                    }
                    if (fieldId.Equals(example.FIELD_NUMERIC_ID))
                    {
                        Assert.AreEqual(field.Validator.Regex, NUMERIC_REGEX);
                        Assert.AreEqual(field.Validator.Message, example.FIELD_NUMERIC_ERROR_MESSAGE);
                        Assert.IsTrue(field.Validator.Disabled);
                    }
                    if (fieldId.Equals(example.FIELD_ALPHANUMERIC_ID))
                    {
                        Assert.AreEqual(field.Validator.Regex, ALPHANUMERIC_REGEX);
                        Assert.AreEqual(field.Validator.Message, example.FIELD_ALPHANUMERIC_ERROR_MESSAGE);
                    }
                    if (fieldId.Equals(example.FIELD_EMAIL_ID))
                    {
                        Assert.AreEqual(field.Validator.Regex, EMAIL_REGEX);
                        Assert.AreEqual(field.Validator.Message, example.FIELD_EMAIL_ERROR_MESSAGE);
                    }
                    if (fieldId.Equals(example.FIELD_URL_ID))
                    {
                        Assert.AreEqual(field.Validator.Regex, URL_REGEX);
                        Assert.AreEqual(field.Validator.Message, example.FIELD_URL_ERROR_MESSAGE);
                    }
                    if (fieldId.Equals(example.FIELD_REGEX_ID))
                    {
                        Assert.AreEqual(field.Validator.Regex, example.FIELD_REGEX);
                        Assert.AreEqual(field.Validator.Message, example.FIELD_REGEX_ERROR_MESSAGE);
                    }
                }
            }
        }
예제 #7
0
        public void verify()
        {
            CustomFieldExample example = new CustomFieldExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            Assert.IsTrue(example.EslClient.GetCustomFieldService().DoesCustomFieldExist(example.customFieldId1));
            Assert.IsFalse(example.EslClient.GetCustomFieldService().DoesCustomFieldExist(example.customFieldId2));

            Assert.AreEqual(documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures.Count, 1);
            Assert.AreEqual(documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures[0].SignerEmail, example.email1);
            Assert.IsNotNull(documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures[0].Fields[0]);

            // Get first custom field
            CustomField retrievedCustomField = example.retrievedCustomField;

            Assert.AreEqual(retrievedCustomField.Id, example.customFieldId1);
            Assert.AreEqual(retrievedCustomField.Value, example.DEFAULT_VALUE);
            Assert.AreEqual(retrievedCustomField.Translations[0].Name, example.ENGLISH_NAME);
            Assert.AreEqual(retrievedCustomField.Translations[0].Language, example.ENGLISH_LANGUAGE);
            Assert.AreEqual(retrievedCustomField.Translations[0].Description, example.ENGLISH_DESCRIPTION);
            Assert.AreEqual(retrievedCustomField.Translations[1].Name, example.FRENCH_NAME);
            Assert.AreEqual(retrievedCustomField.Translations[1].Language, example.FRENCH_LANGUAGE);
            Assert.AreEqual(retrievedCustomField.Translations[1].Description, example.FRENCH_DESCRIPTION);

            // Get entire list of custom fields
            Assert.Greater(example.retrievedCustomFieldList1.Count, 0);

            // Get first page of custom fields
            Assert.Greater(example.retrievedCustomFieldList2.Count, 0);

            // Get the custom field values for this user
            Assert.GreaterOrEqual(example.retrieveCustomFieldValueList1.Count, 1);
            Assert.AreEqual(example.customFieldId1, example.retrieveCustomFieldValue1.Id);
            Assert.AreEqual(example.customFieldId2, example.retrieveCustomFieldValue2.Id);

            // Get the custom field values for this user after deleting 1 user custom field for this user
            Assert.AreEqual(example.retrieveCustomFieldValueList2.Count, example.retrieveCustomFieldValueList1.Count - 1);
        }
예제 #8
0
        public void VerifyResult()
        {
            ConsentExample example = new ConsentExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            // Verify if the required information is correctly extracted.
            Document document = documentPackage.GetDocument("Custom Consent Document");

            Assert.AreEqual(document.Signatures[0].Style, SignatureStyle.ACCEPTANCE);
        }
예제 #9
0
        public void VerifyResult()
        {
            MixingSignatureAndAcceptanceOnOnedocumentExample example = new MixingSignatureAndAcceptanceOnOnedocumentExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            List <Signature> signatures = documentPackage.GetDocument("First Document").Signatures;

            Assert.AreEqual(2, signatures.Count);
            Assert.AreEqual(SignatureStyle.FULL_NAME, signatures[0].Style);
            Assert.AreEqual(SignatureStyle.ACCEPTANCE, signatures[1].Style);
        }
예제 #10
0
        public void VerifyResult()
        {
            DocumentUploadExample example = new DocumentUploadExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            // Verify if the documents was uploaded correctly.
            Assert.AreEqual(3, documentPackage.Documents.Count);

            Document document1 = documentPackage.GetDocument(example.DOCUMENT1_NAME);

            byte[] document1Binary = example.OssClient.DownloadDocument(example.PackageId, document1.Id);
            Assert.Greater(document1Binary.Length, 32000);
            Assert.Less(document1Binary.Length, 33000);

            Document document2 = documentPackage.GetDocument(example.DOCUMENT2_NAME);

            byte[] documen2Binary = example.OssClient.DownloadDocument(example.PackageId, document2.Id);
            Assert.Greater(documen2Binary.Length, 51000);
            Assert.Less(documen2Binary.Length, 52000);
        }
예제 #11
0
        public void VerifyResult()
        {
            DocumentUploadExample example = new DocumentUploadExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            // Verify if the document was uploaded correctly.

            Document document = documentPackage.GetDocument(example.UPLOADED_DOCUMENT_NAME);

            byte[] documentFile = example.EslClient.DownloadDocument(example.PackageId, document.Id);
            Assert.Greater(documentFile.Length, 0);
        }
        public void VerifyResult()
        {
            MobileCaptureSignatureStyleExample example = new MobileCaptureSignatureStyleExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            foreach (Signature signature in documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures)
            {
                if ((int)(signature.X + 0.1) == example.MOBILE_CAPTURE_SIGNATURE_POSITION_X && (int)(signature.Y + 0.1) == example.MOBILE_CAPTURE_SIGNATURE_POSITION_Y)
                {
                    Assert.AreEqual(signature.Style, SignatureStyle.MOBILE_CAPTURE);
                    Assert.AreEqual(signature.Page, example.MOBILE_CAPTURE_SIGNATURE_PAGE);
                }
            }
        }
        public void VerifyResult()
        {
            DocumentAttributesExample example = new DocumentAttributesExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;
            IDictionary <string, object> documentAttributes = documentPackage.GetDocument(example.DOCUMENT_NAME).Data;

            Assert.IsTrue(documentAttributes.ContainsKey(example.ATTRIBUTE_KEY_1));
            Assert.IsTrue(documentAttributes.ContainsKey(example.ATTRIBUTE_KEY_2));
            Assert.IsTrue(documentAttributes.ContainsKey(example.ATTRIBUTE_KEY_3));

            Assert.AreEqual(example.ATTRIBUTE_1, documentAttributes[example.ATTRIBUTE_KEY_1]);
            Assert.AreEqual(example.ATTRIBUTE_2, documentAttributes[example.ATTRIBUTE_KEY_2]);
            Assert.AreEqual(example.ATTRIBUTE_3, documentAttributes[example.ATTRIBUTE_KEY_3]);
        }
        public void VerifyResult()
        {
            example = new DocumentLayoutExample();
            example.Run();

            // Assert the layout was created correctly.
            IList <DocumentPackage> layouts = example.layouts;

            Assert.Greater(layouts.Count, 0);

            foreach (DocumentPackage layout in layouts)
            {
                if (layout.Name.Equals(example.LAYOUT_PACKAGE_NAME))
                {
                    Assert.AreEqual(layout.Id.Id, example.layoutId);
                    Assert.AreEqual(layout.Description, example.LAYOUT_PACKAGE_DESCRIPTION);
                    Assert.AreEqual(layout.Documents.Count, 1);
                    Assert.AreEqual(layout.Signers.Count, 2);

                    Document document = layout.GetDocument(example.LAYOUT_DOCUMENT_NAME);
                    Assert.AreEqual(document.Signatures.Count, 1);

                    // Validate the signature fields of layout were saved correctly.
                    ValidateSignatureFields(document.Signatures);
                }
            }

            // Assert that document layout was applied correctly to document.
            DocumentPackage documentPackage = example.RetrievedPackage;

            Assert.AreNotEqual(documentPackage.Name, example.LAYOUT_PACKAGE_NAME);
            Assert.AreNotEqual(documentPackage.Description, example.LAYOUT_PACKAGE_DESCRIPTION);
            Assert.AreEqual(documentPackage.Signers.Count, 2);
            Assert.AreEqual(documentPackage.Documents.Count, 2);

            Document documentWithLayout = documentPackage.GetDocument(example.APPLY_LAYOUT_DOCUMENT_NAME);

            Assert.AreEqual(documentWithLayout.Description, example.APPLY_LAYOUT_DOCUMENT_DESCRIPTION);
            Assert.AreEqual(documentWithLayout.Id, example.APPLY_LAYOUT_DOCUMENT_ID);
            Assert.AreEqual(documentWithLayout.Signatures.Count, 1);

            // Validate that the signature fields were applied correctly to document.
            ValidateSignatureFields(documentWithLayout.Signatures);
        }
        public void VerifyResult()
        {
            CreateTemplateFromPackageExample example = new CreateTemplateFromPackageExample();

            example.Run();

            DocumentPackage templatePackage = example.EslClient.GetPackage(example.TemplateId);
            Document        document        = templatePackage.GetDocument(example.DOCUMENT_NAME);

            Assert.AreEqual(document.Name, example.DOCUMENT_NAME);
            Assert.AreEqual(document.Id, example.DOCUMENT_ID);

            Assert.AreEqual(templatePackage.Name, example.PACKAGE_NAME_NEW);
            // TODO: Make sure that this is correctly preserved.
            Assert.AreEqual(templatePackage.Signers.Count, 3);
            Assert.AreEqual(templatePackage.GetSigner(example.email1).FirstName, example.PACKAGE_SIGNER1_FIRST);
            Assert.AreEqual(templatePackage.GetSigner(example.email1).LastName, example.PACKAGE_SIGNER1_LAST);
            Assert.AreEqual(templatePackage.GetSigner(example.email2).FirstName, example.PACKAGE_SIGNER2_FIRST);
            Assert.AreEqual(templatePackage.GetSigner(example.email2).LastName, example.PACKAGE_SIGNER2_LAST);
        }
        public void VerifyResult()
        {
            example = new ApplyLayoutByNameExample();
            example.Run();

            // Assert that document layout was applied correctly to document.
            DocumentPackage documentPackage = example.RetrievedPackage;

            Assert.AreNotEqual(documentPackage.Name, example.LAYOUT_PACKAGE_NAME);
            Assert.AreNotEqual(documentPackage.Description, example.LAYOUT_PACKAGE_DESCRIPTION);
            Assert.AreEqual(documentPackage.Signers.Count, 2);
            Assert.AreEqual(documentPackage.Documents.Count, 2);

            Document documentWithLayout = documentPackage.GetDocument(example.APPLY_LAYOUT_DOCUMENT_NAME);

            Assert.AreEqual(documentWithLayout.Description, example.APPLY_LAYOUT_DOCUMENT_DESCRIPTION);
            Assert.AreEqual(documentWithLayout.Id, example.APPLY_LAYOUT_DOCUMENT_ID);
            Assert.AreEqual(documentWithLayout.Signatures.Count, 1);

            // Validate that the signature fields were applied correctly to document.
            ValidateSignatureFields(documentWithLayout.Signatures);
        }
예제 #17
0
        public void VerifyResult()
        {
            BasicPackageCreationExample example = new BasicPackageCreationExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            // Verify if the package is created correctly
            Assert.AreEqual("This is a package created using the eSignLive SDK", documentPackage.Description);
            Assert.AreEqual("This message should be delivered to all signers", documentPackage.EmailMessage);

            Assert.AreEqual(false, documentPackage.Settings.EnableInPerson);

            // Verify if the sdk version is set correctly
            Assert.IsTrue(documentPackage.Attributes.Contents.ContainsKey("sdk"));
            Assert.IsTrue(documentPackage.Attributes.Contents["sdk"].ToString().Contains(".NET"));

            // Verify if the origin is set correctly
            Assert.IsTrue(documentPackage.Attributes.Contents.ContainsKey("origin"));
            Assert.IsTrue(documentPackage.Attributes.Contents["origin"].ToString().Contains("api"));

            // Signer 1
            Signer signer = documentPackage.GetSigner(example.email1);

            Assert.AreEqual("Client1", signer.Id);
            Assert.AreEqual("John", signer.FirstName);
            Assert.AreEqual("Smith", signer.LastName);
            Assert.AreEqual("Managing Director", signer.Title);
            Assert.AreEqual("Acme Inc.", signer.Company);

            // Signer 2
            signer = documentPackage.GetSigner(example.email2);
            Assert.AreEqual("Patty", signer.FirstName);
            Assert.AreEqual("Galant", signer.LastName);

            // Document 1
            Document document = documentPackage.GetDocument(example.DOCUMENT1_NAME);

            Assert.AreEqual(1, document.NumberOfPages);

            List <Field> fields = document.Signatures[0].Fields;
            Field        field  = fields[0];

            Assert.AreEqual(FieldStyle.UNBOUND_CHECK_BOX, field.Style);
            Assert.AreEqual(0, field.Page);
            Assert.AreEqual(FieldBuilder.CHECKBOX_CHECKED, field.Value);

            // Document 2
            document = documentPackage.GetDocument(example.DOCUMENT2_NAME);
            Assert.AreEqual(1, document.NumberOfPages);

            fields = document.Signatures[0].Fields;

            field = findFieldByName("firstField", fields);
            Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
            Assert.AreEqual(0, field.Page);
            Assert.AreEqual("", field.Value);
            Assert.AreEqual("group", field.Validator.Options[0]);

            field = findFieldByName("secondField", fields);
            Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
            Assert.AreEqual(0, field.Page);
            Assert.AreEqual(FieldBuilder.RADIO_SELECTED, field.Value);
            Assert.AreEqual("group", field.Validator.Options[0]);

            field = findFieldByName("thirdField", fields);
            Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
            Assert.AreEqual(0, field.Page);
            Assert.AreEqual("", field.Value);
            Assert.AreEqual("group", field.Validator.Options[0]);
        }
        public void VerifyResult()
        {
            CreatePackageFromTemplateWithFieldsExample example = new CreatePackageFromTemplateWithFieldsExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            foreach (Signature signature in documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures)
            {
                foreach (Field field in signature.Fields)
                {
                    // Textfield
                    if (field.Id == example.TEXTFIELD_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_TEXT_FIELD, field.Style);
                        Assert.AreEqual(example.TEXTFIELD_PAGE, field.Page);
                    }
                    // Checkbox
                    if (field.Id == example.CHECKBOX_1_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_CHECK_BOX, field.Style);
                        Assert.IsNotNull(field.Value);
                        Assert.AreEqual(example.CHECKBOX_1_PAGE, field.Page);
                    }
                    if (field.Id == example.CHECKBOX_2_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_CHECK_BOX, field.Style);
                        Assert.AreEqual(FieldBuilder.CHECKBOX_CHECKED, field.Value);
                        Assert.AreEqual(example.CHECKBOX_2_PAGE, field.Page);
                    }
                    // Radio Button 1
                    if (field.Id == example.RADIO_1_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
                        Assert.AreEqual(example.RADIO_1_PAGE, field.Page);
                        Assert.IsNotNull(field.Validator);
                        Assert.AreEqual(example.RADIO_1_GROUP, field.Validator.Options[0]);
                        Assert.AreEqual("", field.Value);
                    }
                    // Radio Button 2
                    if (field.Id == example.RADIO_2_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
                        Assert.AreEqual(example.RADIO_2_PAGE, field.Page);
                        Assert.IsNotNull(field.Validator);
                        Assert.AreEqual(example.RADIO_2_GROUP, field.Validator.Options[0]);
                        Assert.AreEqual(FieldBuilder.RADIO_SELECTED, field.Value);
                    }
                    // Drop List
                    if (field.Id == example.DROP_LIST_ID)
                    {
                        Assert.AreEqual(example.DROP_LIST_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.DROP_LIST, field.Style);
                        Assert.AreEqual(example.DROP_LIST_OPTION1, field.Validator.Options[0]);
                        Assert.AreEqual(example.DROP_LIST_OPTION2, field.Validator.Options[1]);
                        Assert.AreEqual(example.DROP_LIST_OPTION3, field.Validator.Options[2]);
                        Assert.AreEqual(example.DROP_LIST_OPTION2, field.Value);
                    }
                    // Text Area
                    if (field.Id == example.TEXT_AREA_ID)
                    {
                        Assert.AreEqual(example.TEXT_AREA_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.TEXT_AREA, field.Style);
                        Assert.AreEqual(example.TEXT_AREA_VALUE, field.Value);
                    }
                    // Label Field
                    if (field.Id == example.LABEL_ID)
                    {
                        Assert.AreEqual(example.LABEL_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.LABEL, field.Style);
                        Assert.AreEqual(example.LABEL_VALUE, field.Value);
                    }
                }
            }
        }
예제 #19
0
        public void VerifyResult()
        {
            GenericFieldsExample example = new GenericFieldsExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            foreach (Signature signature in documentPackage.GetDocument(GenericFieldsExample.DOCUMENT_NAME).Signatures)
            {
                foreach (Field field in signature.Fields)
                {
                    // Textfield
                    if (field.Id == GenericFieldsExample.TEXTFIELD_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_TEXT_FIELD, field.Style);
                        Assert.AreEqual(GenericFieldsExample.TEXTFIELD_PAGE, field.Page);
                    }
                    // Checkbox
                    if (field.Id == GenericFieldsExample.CHECKBOX_ID)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_CHECK_BOX, field.Style);
                        Assert.AreEqual(FieldBuilder.CHECKBOX_CHECKED, field.Value);
                        Assert.AreEqual(GenericFieldsExample.CHECKBOX_PAGE, field.Page);
                    }
                    // Radio Button 1
                    if (field.Id == GenericFieldsExample.RADIO_ID_1)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
                        Assert.AreEqual(GenericFieldsExample.RADIO_PAGE, field.Page);
                        Assert.IsNotNull(field.Validator);
                        Assert.AreEqual(GenericFieldsExample.RADIO_GROUP_1, field.Validator.Options[0]);
                        Assert.AreEqual("", field.Value);
                    }
                    // Radio Button 2
                    if (field.Id == GenericFieldsExample.RADIO_ID_2)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
                        Assert.AreEqual(GenericFieldsExample.RADIO_PAGE, field.Page);
                        Assert.IsNotNull(field.Validator);
                        Assert.AreEqual(GenericFieldsExample.RADIO_GROUP_1, field.Validator.Options[0]);
                        Assert.AreEqual(FieldBuilder.RADIO_SELECTED, field.Value);
                    }
                    // Radio Button 3
                    if (field.Id == GenericFieldsExample.RADIO_ID_3)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
                        Assert.AreEqual(GenericFieldsExample.RADIO_PAGE, field.Page);
                        Assert.IsNotNull(field.Validator);
                        Assert.AreEqual(GenericFieldsExample.RADIO_GROUP_2, field.Validator.Options[0]);
                        Assert.AreEqual(FieldBuilder.RADIO_SELECTED, field.Value);
                    }
                    // Radio Button 4
                    if (field.Id == GenericFieldsExample.RADIO_ID_4)
                    {
                        Assert.AreEqual(FieldStyle.UNBOUND_RADIO_BUTTON, field.Style);
                        Assert.AreEqual(GenericFieldsExample.RADIO_PAGE, field.Page);
                        Assert.IsNotNull(field.Validator);
                        Assert.AreEqual(GenericFieldsExample.RADIO_GROUP_2, field.Validator.Options[0]);
                        Assert.AreEqual("", field.Value);
                    }
                    // Drop List
                    if (field.Id == GenericFieldsExample.DROP_LIST_ID)
                    {
                        Assert.AreEqual(GenericFieldsExample.DROP_LIST_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.DROP_LIST, field.Style);
                        Assert.AreEqual(GenericFieldsExample.DROP_LIST_OPTION1, field.Validator.Options[0]);
                        Assert.AreEqual(GenericFieldsExample.DROP_LIST_OPTION2, field.Validator.Options[1]);
                        Assert.AreEqual(GenericFieldsExample.DROP_LIST_OPTION3, field.Validator.Options[2]);
                        Assert.AreEqual(GenericFieldsExample.DROP_LIST_OPTION2, field.Value);
                    }
                    // Text Area
                    if (field.Id == GenericFieldsExample.TEXT_AREA_ID)
                    {
                        Assert.AreEqual(GenericFieldsExample.TEXT_AREA_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.TEXT_AREA, field.Style);
                        Assert.AreEqual(GenericFieldsExample.TEXT_AREA_VALUE, field.Value);
                        Assert.IsTrue(field.Validator.Disabled);
                    }
                    // Label Field
                    if (field.Id == GenericFieldsExample.LABEL_ID)
                    {
                        Assert.AreEqual(GenericFieldsExample.LABEL_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.LABEL, field.Style);
                        Assert.AreEqual(GenericFieldsExample.LABEL_VALUE, field.Value);
                    }
                    // Datepicker Field
                    if (field.Id == GenericFieldsExample.DATEPICKER_ID)
                    {
                        Assert.AreEqual(GenericFieldsExample.DATEPICKER_PAGE, field.Page);
                        Assert.AreEqual(FieldStyle.DATEPICKER, field.Style);
                        Assert.AreEqual(GenericFieldsExample.DATEPICKER_VALUE, field.Value);
                        Assert.IsTrue(field.Validator.Required);
                        Assert.AreEqual(GenericFieldsExample.DATEPICKER_FORMAT, field.Validator.Regex);
                        Assert.AreEqual(field.Validator.Message, FieldValidatorBuilder.DATEPICKER_ERROR_MESSAGE);
                    }
                }
            }
        }
예제 #20
0
        public void VerifyResult()
        {
            DocumentExtractionExample example = new DocumentExtractionExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            // Verify if the required information is correctly extracted.
            Document document = documentPackage.GetDocument(example.DOCUMENT_NAME);

            List <Signature> actualSignatures = document.Signatures;

            Assert.AreEqual(6, actualSignatures.Count, "The number of signatures in extracted document is wrong");

            Signature signature0 = signatureForTopLeft(actualSignatures, 224, 90);

            Assert.IsNotNull(signature0);
            AssertSignature(signature0, 3);
            List <Field> fields0 = signature0.Fields;

            AssertField(fields0, FieldStyle.BOUND_NAME, "{signer.name}", 225, 303, 195, 28, 0);
            AssertField(fields0, FieldStyle.UNBOUND_CHECK_BOX, null, 283, 94, 85, 28, 0);
            AssertField(fields0, FieldStyle.BOUND_NAME, "{signer.name}", 222, 537, 195, 28, 0);
            AssertSignature(signature0, SignatureStyle.HAND_DRAWN, 224, 90, 195, 28, 0);

            Signature signature1 = signatureForTopLeft(actualSignatures, 345, 93);

            Assert.IsNotNull(signature1);
            AssertSignature(signature1, 2);
            List <Field> fields1 = signature1.Fields;

            AssertField(fields1, FieldStyle.UNBOUND_TEXT_FIELD, null, 343, 315, 195, 28, 0);
            AssertField(fields1, FieldStyle.BOUND_TITLE, "{signer.title}", 342, 527, 195, 28, 0);
            AssertSignature(signature1, SignatureStyle.HAND_DRAWN, 345, 93, 195, 28, 0);

            Signature signature2 = signatureForTopLeft(actualSignatures, 81, 89);

            Assert.IsNotNull(signature2);
            AssertSignature(signature2, 0);
            AssertSignature(signature2, SignatureStyle.INITIALS, 81, 89, 195, 28, 0);

            Signature signature3 = signatureForTopLeft(actualSignatures, 131, 541);

            Assert.IsNotNull(signature3);
            AssertSignature(signature3, 1);
            List <Field> fields3 = signature3.Fields;

            AssertField(fields3, FieldStyle.BOUND_COMPANY, "{signer.company}", 170, 542, 195, 28, 0);
            AssertSignature(signature3, SignatureStyle.FULL_NAME, 131, 541, 195, 28, 0);

            Signature signature4 = signatureForTopLeft(actualSignatures, 726, 91);

            Assert.IsNotNull(signature4);
            AssertSignature(signature4, 2);
            List <Field> fields4 = signature4.Fields;

            AssertField(fields4, FieldStyle.BOUND_NAME, "{signer.name}", 724, 299, 195, 28, 0);
            AssertField(fields4, FieldStyle.BOUND_DATE, "{approval.signed}", 724, 509, 195, 28, 0);
            AssertSignature(signature4, SignatureStyle.HAND_DRAWN, 726, 91, 195, 28, 0);

            Signature signature5 = signatureForTopLeft(actualSignatures, 43, 54);

            Assert.IsNotNull(signature5);
            AssertSignature(signature5, 2);
            List <Field> fields5 = signature5.Fields;

            AssertField(fields5, FieldStyle.BOUND_NAME, "{signer.name}", 42, 262, 195, 28, 1);
            AssertField(fields5, FieldStyle.BOUND_DATE, "{approval.signed}", 41, 471, 195, 28, 1);
            AssertSignature(signature5, SignatureStyle.HAND_DRAWN, 43, 54, 195, 28, 1);
        }