コード例 #1
0
        public void DeflateCompressBytesTest()
        {
            string      inputString = "".PadRight(1000, 'z');
            Compression compression = new Compression();

            byte[] inputBytes        = Encoding.UTF8.GetBytes(inputString);
            byte[] compressedBytes   = compression.CompressBytes(CompressionType.Deflate, inputBytes);
            byte[] decompressedBytes = compression.DecompressBytes(CompressionType.Deflate, compressedBytes);

            Assert.LessOrEqual(compressedBytes.Length, inputBytes.Length);
            Assert.AreEqual(inputBytes, decompressedBytes);
        }