Exemplo n.º 1
0
        public void GenerateSignatureAsync_GivenNoTextToSign_ShouldThrowArgumentNullException()
        {
            var defaultSignerUt = new DefaultSigner();

            Func <Task> act = async() => await defaultSignerUt.GenerateSignatureAsync(DefaultRsaKeyXml, null);

            act.Should().Throw <ArgumentNullException>();
        }
Exemplo n.º 2
0
        public void GenerateSignatureAsync_GivenNoRsaKeyXml_ShouldThrowArgumentNullException()
        {
            var defaultSignerUt = new DefaultSigner();

            Func <Task> act = async() => await defaultSignerUt.GenerateSignatureAsync(null, "Some text to sign.");

            act.Should().Throw <ArgumentNullException>();
        }
Exemplo n.º 3
0
        public async Task GenerateSignatureAsync_GivenTextToSign_ShouldReturnValidSignature()
        {
            const string textToSign = "Some text to sign.";

            var defaultSignerUt = new DefaultSigner();

            var expectedSignature = GenerateSignature(textToSign);
            var actualSignature   = await defaultSignerUt.GenerateSignatureAsync(DefaultRsaKeyXml, textToSign);

            actualSignature.Should().Be(expectedSignature);
        }
Exemplo n.º 4
0
        public async Task GenerateSignatureAsync_GivenDifferentTextToSign_ShouldReturnDifferentSignature()
        {
            const string textToSign      = "Some text to sign.";
            const string otherTextToSign = "Some other text to sign.";

            var defaultSignerUt = new DefaultSigner();

            var textToSignSignature = await defaultSignerUt.GenerateSignatureAsync(DefaultRsaKeyXml, textToSign);

            var otherTextToSignSignature = await defaultSignerUt.GenerateSignatureAsync(DefaultRsaKeyXml, otherTextToSign);

            textToSignSignature.Should().NotBe(otherTextToSignSignature);
        }