public void CreateTest() { string filePath = @"F:\ziptest"; string fileName = "tes.zip"; var zipfilepath = new ZipFilePath() { FilePath = filePath, FileName = fileName }; var zip = new com.study.core.utility.io.compression.ZipArchiveFiles(zipfilepath); zip.AddFilesInFolder(@"F:\강의\대용량아키텍처설계\대용량아키텍처설계"); zip.CreateFile(); string zipfile = System.IO.Path.Combine(zipfilepath.FilePath, zipfilepath.FileName); Assert.IsTrue(System.IO.File.Exists(zipfile)); }
public void CreateTestStream() { string filePath = @"F:\ziptest"; string fileName = "tes.zip"; var zipfilepath = new ZipFilePath() { FilePath = filePath, FileName = fileName }; var zip = new com.study.core.utility.io.compression.ZipArchiveFiles(zipfilepath); zip.AddFilesInFolder(@"F:\강의\대용량아키텍처설계\대용량아키텍처설계"); var stream = zip.CreateSream(); stream.Position = 0; string zipfile = System.IO.Path.Combine(zipfilepath.FilePath, zipfilepath.FileName); Assert.IsTrue(System.IO.File.Exists(zipfile)); string doctype = "application/octet-stream"; FileStreamResult fileStreamResult = new FileStreamResult(stream, doctype); fileStreamResult.FileDownloadName = fileName; }