Пример #1
0
        public void CompressSmokeSmall()
        {
            var input = new MemoryStream(Buffer, 0, BufferSizeSmall);
            var output = new MemoryStream();

            var compressor = new BZip2OutputStream(output, false);
            input.CopyTo(compressor);
            compressor.Close();

            // Estimated size between inputSize*0.5 and inputSize*1.1
            Assert.IsTrue(output.Length > BufferSizeSmall * 0.5);
            Assert.IsTrue(output.Length < BufferSizeSmall * 1.1);
        }
Пример #2
0
        public void CompressAndDecompress()
        {
            var input = new MemoryStream(Buffer);
            var output = new MemoryStream();

            var compressor = new BZip2OutputStream(output, false);
            input.CopyTo(compressor);
            compressor.Close();

            Assert.IsTrue(output.Length > 4);

            output.Position = 0;
            var output2 = new MemoryStream();
            var decompressor = new BZip2InputStream(output, false);
            decompressor.CopyTo(output2);

            Assert.AreEqual(Buffer.Length, output2.Length);
        }