public void ProgressBarIsFilled()
        {
            var source = new MemoryStream();
            source.SetLength(rand.Next(65536, 1048576));

            var pr = new EmptyProgressReporter();
            ProgressOperations.CopyTo(source, Stream.Null, pr);
            Assert.AreEqual(source.Length, pr.Maximum);
            Assert.AreEqual(pr.Maximum, pr.Progress);
        }
        public void ComputeHashTest()
        {
            var bytes = new byte[rand.Next(65536, 1048576)];
            rand.NextBytes(bytes);

            var source = new MemoryStream(bytes);

            var knownHash = new SHA512Managed().ComputeHash(source);
            source.Position = 0;

            var pr = new EmptyProgressReporter();
            var myHash = ProgressOperations.ComputeHash(new SHA512Managed(), source, pr);

            CollectionAssert.AreEqual(knownHash, myHash);
            Assert.AreEqual(source.Length, pr.Maximum);
            Assert.AreEqual(pr.Maximum, pr.Progress);
        }