-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathCreateSigningLinkToTheDocument.cs
More file actions
35 lines (31 loc) · 1.25 KB
/
CreateSigningLinkToTheDocument.cs
File metadata and controls
35 lines (31 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace SignNow.Net.Examples
{
public partial class DocumentExamples
{
[TestMethod]
public async Task CreateSigningLinkToTheDocumentAsync()
{
// Upload a document with a signature field
await using var fileStream = File.OpenRead(PdfWithSignatureField);
var document = await testContext.Documents
.UploadDocumentWithFieldExtractAsync(fileStream, "CreateSigningLinkToTheDocument.pdf")
.ConfigureAwait(false);
// Create a signing link to the document for signature
var signingLink = await testContext.Documents
.CreateSigningLinkAsync(document?.Id)
.ConfigureAwait(false);
// Validate the response
Assert.IsNotNull(signingLink.Url);
Assert.IsNotNull(signingLink.AnonymousUrl);
Assert.IsInstanceOfType(signingLink.Url, typeof(Uri));
Assert.AreEqual("https", signingLink.Url.Scheme);
Assert.IsFalse(string.IsNullOrEmpty(signingLink.Url.OriginalString));
// Clean up
DeleteTestDocument(document?.Id);
}
}
}