public async Task TestDecompress(string filename, string sha256) { using var ms = new MemoryStream(); using var fs = new FileStream(filename, FileMode.Open, FileAccess.Read); await PipeHelper.DecompressAsync(PipeReader.Create(fs), PipeWriter.Create(new NoDisposableStream(ms))); ms.Seek(0, SeekOrigin.Begin); byte[] actual = SHA256.Create().ComputeHash(ms); byte[] expected = HexHelper.StringToByteArray(sha256); Assert.True(actual.AsSpan().SequenceEqual(expected)); }
public void TestDecompress(string filename, string sha256) { using var ms = new MemoryStream(); using var fs = new FileStream(filename, FileMode.Open, FileAccess.Read); using var fse = new FseStream(fs, CompressionMode.Decompress, true); fse.CopyTo(ms); ms.Seek(0, SeekOrigin.Begin); byte[] actual = SHA256.Create().ComputeHash(ms); byte[] expected = HexHelper.StringToByteArray(sha256); Assert.True(actual.AsSpan().SequenceEqual(expected)); }