Esempio n. 1
0
        public void VerifyResult()
        {
            example = new DocumentLayoutExample(Props.GetInstance());
            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.Documents[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 packageWithLayout = example.packageWithLayout;

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

            Document documentWithLayout = packageWithLayout.Documents[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()
        {
            example = new DocumentLayoutExample(Props.GetInstance());
            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.Documents[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 packageWithLayout = example.packageWithLayout;

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

            Document documentWithLayout = packageWithLayout.Documents[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);
        }