Ejemplo n.º 1
0
 public void GZipCompressorBytesExtesionWorks()
 {
     var compressor = new GZipCompressor();
     var compressed = compressor.Compress(Encoding.UTF8.GetBytes("test"));
     Assert.IsNotNull(compressed);
     var decompressor = new GZipDecompressor();
     var decompressed = decompressor.Decompress(compressed);
     Assert.IsNotNull(decompressed);
     Assert.AreEqual("test", Encoding.UTF8.GetString(decompressed));
 }
Ejemplo n.º 2
0
 public void GZipICompressorIDecompressorWorks()
 {
     var compressor = new GZipCompressor();
     var data = Encoding.UTF8.GetBytes("test");
     byte[] compressed;
     using (var inputStream = new MemoryStream(data))
     {
         compressed = compressor.Compress(inputStream);
     }
     Console.WriteLine(compressed.Length);
     Assert.IsNotNull(compressed);
     var decompressor = new GZipDecompressor();
     byte[] decompressed;
     using (var inputStream = new MemoryStream(compressed))
     {
         decompressed = decompressor.Decompress(inputStream);
     }
     Assert.IsNotNull(decompressed);
     Assert.AreEqual("test", Encoding.UTF8.GetString(decompressed));
 }