-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathUploadDocument.cs
More file actions
31 lines (26 loc) · 964 Bytes
/
UploadDocument.cs
File metadata and controls
31 lines (26 loc) · 964 Bytes
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
using System.IO;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace SignNow.Net.Examples
{
public partial class DocumentExamples
{
[TestMethod]
public async Task UploadDocumentAsync()
{
await using var fileStream = File.OpenRead(PdfWithoutFields);
// Upload the document
var uploadResponse = await testContext.Documents
.UploadDocumentAsync(fileStream, "document-example.pdf")
.ConfigureAwait(false);
// Gets document after from successful upload
var uploadedDocument = await testContext.Documents
.GetDocumentAsync(uploadResponse.Id)
.ConfigureAwait(false);
// Check uploaded document
Assert.AreEqual(uploadResponse.Id, uploadedDocument.Id);
// clean up
DeleteTestDocument(uploadedDocument.Id);
}
}
}