public async Task GivenKnownDataDigestIsCorrectlyCalculatedIetfTest() { // Arrange var content = new StringContent("{\"hello\": \"world\"}"); DigestGenerator generator = new DigestGenerator("SHA-256"); // Act var result = generator.CalculateDigest(await content.ReadAsStreamAsync()); // Assert Assert.Equal("SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=", result); }
public async Task UseTheSpecificationToGetTheHashAlgorithm() { // Arrange var content = new StringContent("{\"hello\": \"world\"}"); ISignatureSpecification signatureSpecification = new SignatureSpecification() { HashAlgorithm = "SHA-256" }; DigestGenerator generator = new DigestGenerator(signatureSpecification); // Act var result = generator.CalculateDigest(await content.ReadAsStreamAsync()); // Assert Assert.Equal("SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=", result); }
public async Task GivenKnownDataDigestIsCorrectlyCalculatedTellerTest() { // Arrange Dictionary <string, string> data = new Dictionary <string, string> { { "bank_code", "00-00-00" }, { "account_number", "00000000" }, { "amount", "0.01" } }; var content = new FormUrlEncodedContent(data); DigestGenerator generator = new DigestGenerator("SHA256"); // Act var result = generator.CalculateDigest(await content.ReadAsStreamAsync()); // Assert Assert.Equal("SHA256=dX9LYG6i/d+TuzG0QMckFzqOZ6Wll/TlGGjUtqGyMhQ=", result); }