public void CreateZipFileWithFilesAndADirectory() { var zipFilePath = TestHelper.GetCurrentMethodName() + ".zip"; const string file1Path = @".\file1.txt"; const string file2Path = @".\dir\file2.txt"; DeleteFilesIfExist(new [] { zipFilePath, file1Path, file2Path }); Directory.CreateDirectory(@".\dir"); CreateTestFile(file1Path); CreateTestFile(file2Path); ZipFileUtils.Create(zipFilePath, new List <string> { file1Path, file2Path }); var zipfileExists = File.Exists(zipFilePath); Directory.Delete(@".\dir", true); DeleteFilesIfExist(new [] { file1Path, file2Path }); ZipFileUtils.Extract(zipFilePath, "."); DeleteFilesIfExist(new [] { zipFilePath }); var file1Exists = File.Exists(file1Path); var file2Exists = File.Exists(file2Path); DeleteFilesIfExist(new[] { zipFilePath, file1Path, file2Path }); Assert.IsTrue(zipfileExists); Assert.IsTrue(file1Exists); Assert.IsTrue(file2Exists); }
public void CreateZipFileWithFiles() { var zipFilePath = TestHelper.GetCurrentMethodName() + ".zip"; const string file1Path = @".\file1.txt"; const string file2Path = @".\file2.txt"; DeleteFilesIfExist(new[] { zipFilePath, file1Path, file2Path }); var file1 = File.CreateText(file1Path); var file2 = File.CreateText(file2Path); file1.WriteLine("TestFile1"); file2.WriteLine("TestFile2"); file1.Close(); file2.Close(); ZipFileUtils.Create(zipFilePath, new List <string> { file1Path, file2Path }); var zipfileExists = File.Exists(zipFilePath); DeleteFilesIfExist(new[] { file1Path, file2Path }); ZipFileUtils.Extract(zipFilePath, "."); var file1Exists = File.Exists(file1Path); var file2Exists = File.Exists(file2Path); DeleteFilesIfExist(new[] { zipFilePath, file1Path, file2Path }); Assert.IsTrue(zipfileExists); Assert.IsTrue(file1Exists); Assert.IsTrue(file2Exists); }
public void ExtractFromZipFile() { File.Delete("LogoNLMW.xml"); ZipFileUtils.Extract(@"..\..\..\..\Data\ZipFile\metadata.zip", "."); Assert.IsTrue(File.Exists("LogoNLMW.xml")); }
public void ExtractFromZipFile() { File.Delete("LogoNLMW.xml"); ZipFileUtils.Extract(@"..\..\..\..\..\test-data\Common\DelftTools.Tests\zipfile\MetaData.zip", "."); Assert.IsTrue(File.Exists("LogoNLMW.xml")); }