public async Task StringAsyncTest(string path) { var text = File.ReadAllText(path); ICryptoGraph crypto = new CryptographAes(); var iv = crypto.GenerateIv(); var actual = await crypto.EncryptAsync(text, iv, key); var decrypt = await crypto.DecryptAsync(actual, iv, key); decrypt.Should().Be(text); }
public async Task BytesAsyncTest(string path) { var data = File.ReadAllBytes(path); ICryptoGraph crypto = new CryptographAes(); var iv = crypto.GenerateIv(); var actual = await crypto.EncryptAsync(data, iv, key); var decrypt = await crypto.DecryptAsync(actual, iv, key); decrypt.Should().BeEquivalentTo(data); }