public async Task RotatingKeyEncryptor_EncryptDecrypt_bytes()
        {
            var encr1   = new SymmetricEncryptor(new Key(new EncryptionPolicy()));
            var factory = new Mock <IRotatingEncryptorFactory>();
            var encr    = new RotatingKeyEncryptor(factory.Object);

            factory.Setup((f) => f.GetValidForEncryption()).ReturnsAsync(encr1);
            factory.Setup((f) => f.GetValidForDecryption(encr1.Policy.Id)).ReturnsAsync(encr1);

            await TestEncryptDecrypt(encr, DataToEncrypt1);
            await TestEncryptDecrypt(encr, DataToEncrypt2);
            await TestEncryptDecrypt(encr, DataToEncrypt3);
            await TestEncryptDecrypt(encr, DataToEncrypt4);
        }
        public async Task RotatingKeyEncryptor_EncryptDecrypt_stream()
        {
            var encr1   = new SymmetricEncryptor(new Key(new EncryptionPolicy()));
            var factory = new Mock <IRotatingEncryptorFactory>();
            var encr    = new RotatingKeyEncryptor(factory.Object);

            factory.Setup((f) => f.GetValidForEncryption()).ReturnsAsync(encr1);
            factory.Setup((f) => f.GetValidForDecryption(encr1.Policy.Id)).ReturnsAsync(encr1);

            var input = new MemoryStream();
            var sb    = new StringBuilder();

            // Initialize input with some data (> buffer size which is 64k)
            for (var i = 0; i < 600; ++i)
            {
                await input.WriteAsync(data);

                sb.Append(data);
            }

            input.Seek(0, SeekOrigin.Begin);

            await TestEncryptDecrypt(encr, input, sb.ToString());
        }