コード例 #1
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);
        }
コード例 #2
0
        public void GenerateSignatureAsync_GivenNoTextToSign_ShouldThrowArgumentNullException()
        {
            var defaultSignerUt = new DefaultSigner();

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

            act.Should().Throw <ArgumentNullException>();
        }
コード例 #3
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>();
        }
コード例 #4
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);
        }