Example #1
0
        public async Task Should_fail_when_given_null_uploader()
        {
            var uploadStrategy = new DocumentContentToUpload(documentContent);

            Func <Task> func = async() => await uploadStrategy.UploadAndSignAsync(accountId, null !, crypt, 1.Seconds());

            await func.Should().ThrowAsync <ArgumentException>();
        }
Example #2
0
        public async Task Should_upload_without_sign()
        {
            var uploadStrategy = new DocumentContentToUpload(documentContent);

            var(contentId, signature) = await uploadStrategy.UploadAndSignAsync(accountId, uploader, crypt, 1.Seconds());

            contentId.Should().Be(expectedContentId);
            signature.Should().BeNull();
        }
Example #3
0
        public async Task Should_upload_content_with_given_signature()
        {
            var expectedSignature = Signature.FromBytes(new byte[] { 3, 4, 5, 6 });
            var uploadStrategy    = new DocumentContentToUpload(documentContent, expectedSignature);

            var(contentId, signature) = await uploadStrategy.UploadAndSignAsync(accountId, uploader, crypt, 1.Seconds());

            contentId.Should().Be(expectedContentId);
            signature.Should().BeEquivalentTo(expectedSignature);
        }
Example #4
0
        public async Task Should_upload_and_sign_content_by_given_certificate()
        {
            var expectedSignature  = Signature.FromBytes(new byte[] { 3, 4, 5, 6, 7 });
            var certificateContent = CertificateContent.FromBytes(new byte[] { 1, 2, 3 });

            documentContent.SignAsync(certificateContent, crypt)
            .Returns(expectedSignature);
            var uploadStrategy = new DocumentContentToUpload(documentContent, certificateContent);

            var(contentId, signature) = await uploadStrategy.UploadAndSignAsync(accountId, uploader, crypt, 1.Seconds());

            contentId.Should().Be(expectedContentId);
            signature.Should().BeEquivalentTo(expectedSignature);
        }