예제 #1
0
        public void HashFullArrayInvalidArguments()
        {
            using (HashAlgorithm hash = new Length32Hash())
            {
                Assert.Throws <ArgumentNullException>(() => hash.ComputeHash((byte[])null));

                hash.Dispose();

                Assert.Throws <ObjectDisposedException>(() => hash.ComputeHash(s_tenBytes));
            }
        }
예제 #2
0
        public void HashFullArrayInvalidArguments()
        {
            using (HashAlgorithm hash = new Length32Hash())
            {
                Assert.Throws<ArgumentNullException>(() => hash.ComputeHash((byte[])null));

                hash.Dispose();

                Assert.Throws<ObjectDisposedException>(() => hash.ComputeHash(s_tenBytes));
            }
        }
예제 #3
0
        public void StreamHashInvalidArguments()
        {
            using (var stream = new PositionValueStream(0))
                using (HashAlgorithm hash = new Length32Hash())
                {
                    Assert.Throws <NullReferenceException>(() => hash.ComputeHash((Stream)null));

                    hash.Dispose();

                    Assert.Throws <ObjectDisposedException>(() => hash.ComputeHash(stream));
                }
        }
예제 #4
0
        public void HashPartialArrayInvalidArguments()
        {
            using (HashAlgorithm hash = new Length32Hash())
            {
                Assert.Throws <ArgumentNullException>(() => hash.ComputeHash((byte[])null, 0, 0));
                Assert.Throws <ArgumentOutOfRangeException>(() => hash.ComputeHash(s_tenBytes, -1, 0));
                Assert.Throws <ArgumentException>(() => hash.ComputeHash(s_tenBytes, 0, -1));
                Assert.Throws <ArgumentException>(() => hash.ComputeHash(s_tenBytes, 0, 11));
                Assert.Throws <ArgumentException>(() => hash.ComputeHash(s_tenBytes, 9, 2));

                hash.Dispose();

                Assert.Throws <ObjectDisposedException>(() => hash.ComputeHash(s_tenBytes, 0, 10));
            }
        }
예제 #5
0
        public void HashPartialArrayInvalidArguments()
        {
            using (HashAlgorithm hash = new Length32Hash())
            {
                Assert.Throws<ArgumentNullException>(() => hash.ComputeHash((byte[])null, 0, 0));
                Assert.Throws<ArgumentOutOfRangeException>(() => hash.ComputeHash(s_tenBytes, -1, 0));
                Assert.Throws<ArgumentException>(() => hash.ComputeHash(s_tenBytes, 0, -1));
                Assert.Throws<ArgumentException>(() => hash.ComputeHash(s_tenBytes, 0, 11));
                Assert.Throws<ArgumentException>(() => hash.ComputeHash(s_tenBytes, 9, 2));

                hash.Dispose();

                Assert.Throws<ObjectDisposedException>(() => hash.ComputeHash(s_tenBytes, 0, 10));
            }
        }
        public void StreamHashInvalidArguments()
        {
            using (var stream = new PositionValueStream(0))
            using (HashAlgorithm hash = new Length32Hash())
            {
                Assert.Throws<NullReferenceException>(() => hash.ComputeHash((Stream)null));

                hash.Dispose();

                Assert.Throws<ObjectDisposedException>(() => hash.ComputeHash(stream));
            }
        }