Ejemplo n.º 1
0
        public void GenerateSignatureAsync_GivenNoObjectUrl_ShouldThrowArgumentNullException()
        {
            var mockSigner        = new Mock <ISigner>();
            var objectUrlSignerUt = new ObjectUrlSigner(mockSigner.Object);

            Func <Task> act = async() => await objectUrlSignerUt.GenerateSignatureAsync("Some key.", null);

            act.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 2
0
        public void GenerateSignatureAsync_GivenNoRsaKeyXml_ShouldThrowArgumentNullException()
        {
            var mockSigner        = new Mock <ISigner>();
            var objectUrlSignerUt = new ObjectUrlSigner(mockSigner.Object);

            Func <Task> act = async() => await objectUrlSignerUt.GenerateSignatureAsync(null, CreateTestObjectUrl());

            act.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 3
0
        public async Task GenerateSignatureAsync_GivenHttpExecutionRequest_ShouldReturnSignature()
        {
            var mockSigner        = new Mock <ISigner>();
            var objectUrlSignerUt = new ObjectUrlSigner(mockSigner.Object);
            var testRsaKeyXml     = "Some key.";
            var testObjectUrl     = CreateTestObjectUrl();
            var expectedSignature = "It worked!";

            mockSigner.Setup(s => s.GenerateSignatureAsync(testRsaKeyXml, testObjectUrl.Url))
            .Returns(Task.FromResult(expectedSignature));

            var actualSignature = await objectUrlSignerUt.GenerateSignatureAsync(testRsaKeyXml, testObjectUrl);

            actualSignature.Should().Be(expectedSignature);
        }