예제 #1
0
        public void WhenDisposed_ShouldDisposeAlgorithm()
        {
            // Arrange
            var fixture  = new Fixture();
            var values   = fixture.Create <byte[]>();
            var expected = typeof(ObjectDisposedException);

            // TODO: Mock Crypto.HashAlgorithm?
            var hashAlgorithm = Crypto.MD5.Create();
            var algorithm     = new HashingLibrary.Algorithms.CryptographyWrapper(hashAlgorithm);

            algorithm.Dispose();

            // Act
            var actual = ExceptionTest.Catch(() => hashAlgorithm.ComputeHash(values));

            // Assert
            Assert.IsInstanceOfType(actual, expected);
        }