public void VerifyResult() { example = new AttachmentRequirementExample( Props.GetInstance() ); example.Run(); // Asserts the attachment requirements for each signer is set correctly. DocumentPackage retrievedPackage = example.RetrievedPackage; IDictionary<string, AttachmentRequirement> signer1Attachments = retrievedPackage.Signers[example.Email1].Attachments; IDictionary<string, AttachmentRequirement> signer2Attachments = retrievedPackage.Signers[example.Email2].Attachments; Assert.AreEqual(signer1Attachments.Count, 1); AttachmentRequirement signer1Att1 = signer1Attachments[example.NAME1]; Assert.AreEqual(signer1Att1.Name, example.NAME1); Assert.AreEqual(signer1Att1.Description, example.DESCRIPTION1); Assert.AreEqual(signer1Att1.Required, true); Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.INCOMPLETE.ToString()); Assert.AreEqual(signer2Attachments.Count, 2); AttachmentRequirement signer2Att1 = signer2Attachments[example.NAME2]; AttachmentRequirement signer2Att2 = signer2Attachments[example.NAME3]; Assert.AreEqual(signer2Att1.Name, example.NAME2); Assert.AreEqual(signer2Att1.Description, example.DESCRIPTION2); Assert.AreEqual(signer2Att1.Required, false); Assert.AreEqual(signer2Att1.Status.ToString(), RequirementStatus.INCOMPLETE.ToString()); Assert.AreEqual(signer2Att2.Name, example.NAME3); Assert.AreEqual(signer2Att2.Description, example.DESCRIPTION3); Assert.AreEqual(signer2Att2.Required, true); Assert.AreEqual(signer2Att2.Status.ToString(), RequirementStatus.INCOMPLETE.ToString()); // Upload attachment for signer1 string signerAuthenticationToken = example.EslClient.AuthenticationTokenService.CreateSignerAuthenticationToken(example.PackageId, example.SIGNER1ID); AuthenticationClient authenticationClient = new AuthenticationClient(Props.GetInstance().Get("webpage.url")); String sessionIdForSigner = authenticationClient.GetSessionIdForSignerAuthenticationToken(signerAuthenticationToken); client = new RestClient(""); template = new UrlTemplate(Props.GetInstance().Get("api.url")); Stream fileStream1 = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf").FullName); uploadAttachment(example.PackageId, signer1Att1.Id, "Test Attachment", fileStream1, sessionIdForSigner); // Reject signer1's attachment example.RejectAttachment(); signer1Att1 = retrievedPackage.Signers[example.Email1].Attachments[example.NAME1]; Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.REJECTED.ToString()); Assert.AreEqual(signer1Att1.SenderComment, example.REJECTION_COMMENT); // Accept signer1's attachment example.AcceptAttachment(); Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.COMPLETE.ToString()); Assert.AreEqual(signer1Att1.SenderComment, ""); // Download signer1's attachment byte[] downloadedAttachment = example.DownloadAttachment(); System.IO.File.WriteAllBytes("/dev/null", downloadedAttachment); }
public SigningRedirectForSignerExample( string apiKey, string apiUrl, string webpageUrl, string signerEmail) : base( apiKey, apiUrl ) { this.signerEmail = signerEmail; this.authenticationClient = new AuthenticationClient(webpageUrl); this.fileStream = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf").FullName); }
public UserAuthenticationTokenExample( string apiKey, string apiUrl, string webpageUrl) : base( apiKey, apiUrl ) { this.AuthenticationClient = new AuthenticationClient(webpageUrl); }
public SenderAuthenticationTokenExample( string apiKey, string apiUrl, string webpageUrl) : base( apiKey, apiUrl ) { this.AuthenticationClient = new AuthenticationClient(webpageUrl); this.fileStream = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf").FullName); }
public DesignerRedirectForPackageSenderExample( string apiKey, string apiUrl, string webpageUrl) : base( apiKey, apiUrl ) { this.packageSenderEmail = GetRandomEmail(); this.authenticationClient = new AuthenticationClient(webpageUrl); this.fileStream = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf").FullName); }