示例#1
0
        public void AddingFile_WithHttpMethod_IsExpected()
        {
            var sut = new AddFileToDocumentBuilder().Build();

            var actual = sut.Method;

            Assert.AreEqual(HttpMethod.Post, actual);
        }
示例#2
0
        public void AddingFile_WithFileNAme_SetsUriCorrectly()
        {
            var sut = new AddFileToDocumentBuilder().WithFileName("secret.pdf").Build();

            var actual = sut.ResourceUri;

            StringAssert.EndsWith("?filename=secret.pdf", actual);
        }
示例#3
0
        public void AddingFile_WithFileName_UrlEncodesIt()
        {
            var sut = new AddFileToDocumentBuilder().WithFileName("  .pdf").Build();

            var actual = sut.ResourceUri;

            StringAssert.EndsWith("++.pdf", actual);
        }
示例#4
0
        public void AddingFile_WithLocation_SetsUriCorrectly()
        {
            var sut = new AddFileToDocumentBuilder()
                      .WithLocation(new LocationDtoBuilder().WithLocation("https://sign.visma.net/api/v1/document/e59c8dc8-8848-4936-ac7c-50d9ed72085a"))
                      .Build();

            var actual = sut.ResourceUri;

            StringAssert.StartsWith("api/v1/document/e59c8dc8-8848-4936-ac7c-50d9ed72085a/files?", actual);
        }
示例#5
0
        public void AddingFile_WithAttachment_SetsContentCorrectly()
        {
            var sut = new AddFileToDocumentBuilder().WithAttachment(0x20).Build();

            var content = sut.Content as ByteArrayContent;

            var actualBytes = content.ReadAsByteArrayAsync().Result;

            Assert.AreEqual(new byte[] { 0x20 }, actualBytes);
            Assert.AreEqual("application/pdf", content.Headers.ContentType.MediaType);
        }