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); }
public void GenerateSignatureAsync_GivenNoTextToSign_ShouldThrowArgumentNullException() { var defaultSignerUt = new DefaultSigner(); Func <Task> act = async() => await defaultSignerUt.GenerateSignatureAsync(DefaultRsaKeyXml, null); act.Should().Throw <ArgumentNullException>(); }
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>(); }
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); }