public void DecompressStream_Should_Extract_Data_Correctly() { var testData = new Dictionary <string, DecompressionMethods> { { FileName, DecompressionMethods.None }, { FileName + ".deflate", DecompressionMethods.Deflate }, { FileName + ".gzip", DecompressionMethods.GZip } }; var expected = File.ReadAllBytes(FileName); foreach (var data in testData) { using (var stream = StreamTask.DecompressStream(data.Key, data.Value)) { using (var memStream = new MemoryStream()) { stream.CopyTo(memStream); Assert.IsTrue(expected.SequenceEqual(memStream.ToArray()), "DecompressStream failed for {data.Value}"); } } CheckFileIsClosed(data.Key); } }