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); }
public bool CheckIfAllRijindaelManagedDisposed() { return(RijndaelManagedCreated.All(pred => SymmetricAlgorithmsDisposed.Contains(pred))); }