public void DeflateCompressorStringExtesionWorks() { var compressor = new DeflateCompressor(); var compressed = compressor.Compress("test"); Assert.IsNotNull(compressed); var decompressor = new DeflateDecompressor(); var decompressed = decompressor.Decompress(compressed); Assert.IsNotNull(decompressed); Assert.AreEqual("test", Encoding.UTF8.GetString(decompressed)); }
public void DeflateICompressorIDecompressorWorks() { var compressor = new DeflateCompressor(); 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 DeflateDecompressor(); byte[] decompressed; using (var inputStream = new MemoryStream(compressed)) { decompressed = decompressor.Decompress(inputStream); } Assert.IsNotNull(decompressed); Assert.AreEqual("test", Encoding.UTF8.GetString(decompressed)); }