Example #1
0
        private void InitializeStaticShims()
        {
            ShimRijndaelManaged.Constructor = instance => RijndaelManagedCreated.Add(instance);
            ShimRijndaelManaged.AllInstances.CreateEncryptorByteArrayByteArray = (instance, a, b) =>
            {
                var result = new TestableCryptoTransform();
                EncryptorsCreated.Add(result);
                return(result);
            };
            ShimRijndaelManaged.AllInstances.CreateDecryptorByteArrayByteArray = (instance, a, b) =>
            {
                var result = new TestableCryptoTransform();
                DecryptorsCreated.Add(result);
                return(result);
            };

            ShimSymmetricAlgorithm.AllInstances.Dispose        = instance => SymmetricAlgorithmsDisposed.Add(instance);
            ShimSymmetricAlgorithm.AllInstances.DisposeBoolean = (instance, flag) => SymmetricAlgorithmsDisposed.Add(instance);

            ShimDeriveBytes.Constructor          = instance => DeriveBytesCreated.Add(instance);
            ShimDeriveBytes.AllInstances.Dispose = instance => DeriveBytesDisposed.Add(instance);
        }
Example #2
0
 public bool CheckIfAllRijindaelManagedDisposed()
 {
     return(RijndaelManagedCreated.All(pred => SymmetricAlgorithmsDisposed.Contains(pred)));
 }