public void IsGZipShouldReturnTrueForZipArchive() { var file = Path.Join(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString() + ".xml.gz"); try { GZipTests.CreateCompressedFile(file); Assert.IsTrue(GZip.IsGZip(file)); } finally { File.Delete(file); } }
public void DecompressAndCompressFileShouldReturnIdenticalFile() { var compressedFile = Path.Join(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString() + ".xml.gz"); var decompressedFile = Path.Join(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString() + ".xml"); var compressedFile1 = Path.Join(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString() + ".xml.gz"); try { GZipTests.CreateCompressedFile(compressedFile); GZip.Decompress(compressedFile, decompressedFile); GZip.Compress(decompressedFile, compressedFile1); var hash1 = GZipTests.GetFileHash(compressedFile); var hash2 = GZipTests.GetFileHash(compressedFile1); Assert.IsTrue(hash1.SequenceEqual(hash2)); } finally { File.Delete(compressedFile); File.Delete(decompressedFile); File.Delete(compressedFile1); } }