public override IFastZipPackage LoadStagedPackage(HashingWriteStream packageStream)
 {
     packageStream.Close();
     return(new FastZipPackage
     {
         Id = "Sample",
         Version = new SemanticVersion("1.0"),
         FileLocation = packageStream.FileLocation,
         Hash = packageStream.Hash
     });
 }
        public void ComputesHash()
        {
            var stream = new HashingWriteStream(null, new MemoryStream(), new SHA256CryptoServiceProvider());

            stream.Write(textBytes, 0, textBytes.Length);
            stream.Close();

            var expectedHash = new SHA256CryptoServiceProvider().ComputeHash(textBytes);

            Assert.That(stream.Hash, Is.EqualTo(expectedHash));
        }
        public async Task CopyToAsync_ComputesHash()
        {
            var source = new MemoryStream(textBytes);
            var dest   = new MemoryStream();
            var stream = new HashingWriteStream(null, dest, new SHA256CryptoServiceProvider());

            await source.CopyToAsync(stream);

            stream.Close();

            var expectedHash = new SHA256CryptoServiceProvider().ComputeHash(textBytes);

            Assert.That(stream.Hash, Is.EqualTo(expectedHash));
        }