public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;
                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();
                Assert.Null(keyedHash.Key);
            }
        }
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;
                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();
                Assert.Null(keyedHash.Key);
            }
        }
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();

                byte[] ignored;
                Assert.Throws<NullReferenceException>(() => ignored = keyedHash.Key);
            }
        }
Beispiel #4
0
        public void EnsureDisposeFreesKey()
        {
            byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };

            using (var keyedHash = new TestKeyedHashAlgorithm())
            {
                keyedHash.Key = key;

                Assert.NotNull(keyedHash.Key);

                keyedHash.Dispose();

                byte[] ignored;
                Assert.Throws <NullReferenceException>(() => ignored = keyedHash.Key);
            }
        }