Esempio n. 1
0
        public void RoundTrip_BatchToStreaming()
        {
            var testBuffer = DataGenerator.GetLargeBuffer(DataFill.Sequential);

            byte[] compressedBuffer;

            using (var compressor = new Compressor())
                compressedBuffer = compressor.Wrap(testBuffer);

            var resultStream = new MemoryStream();

            using (var decompressionStream = new DecompressorStream(new MemoryStream(compressedBuffer)))
                decompressionStream.CopyTo(resultStream);

            Validate(testBuffer, resultStream.ToArray());
        }
Esempio n. 2
0
        public void RoundTrip_StreamingStreaming()
        {
            var testStream = DataGenerator.GetLargeStream(DataFill.Sequential);
            var tempStream = new MemoryStream();

            using (var compressionStream = new CompressorStream(tempStream))
                testStream.CopyTo(compressionStream);

            var resultStream = new MemoryStream();

            tempStream.Position = 0;
            using (var decompressionsStream = new DecompressorStream(tempStream))
                decompressionsStream.CopyTo(resultStream);

            Validate(testStream.ToArray(), resultStream.ToArray());
        }