Example #1
0
        public void ComputeHash_ExceptionsTest()
        {
            byte[] goodBa = { 1, 2, 3 };
            Sha512 sha    = new Sha512();

            Assert.Throws <ArgumentNullException>(() => sha.ComputeHash(null));
            Assert.Throws <ArgumentNullException>(() => sha.ComputeHash(null, 0, 1));
            Assert.Throws <IndexOutOfRangeException>(() => sha.ComputeHash(goodBa, 0, 5));
            Assert.Throws <IndexOutOfRangeException>(() => sha.ComputeHash(goodBa, 10, 1));

            sha.Dispose();
            Assert.Throws <ObjectDisposedException>(() => sha.ComputeHash(goodBa));
            Assert.Throws <ObjectDisposedException>(() => sha.ComputeHash(goodBa, 0, 2));
        }