コード例 #1
0
        public async Task Compress_ShouldZipFolder()
        {
            var textFilePath = Path.Combine(sourceDirectoryPath, "compress.txt");
            await File.WriteAllTextAsync(textFilePath, "Compress test.");

            zipFilePath = await fileZipper.Compress(sourceDirectoryPath);

            Debugger.Break();

            FileAssert.Exists(zipFilePath);
            FileAssert.ZipHasFiles(zipFilePath, expectedFileCount: 1);
        }
コード例 #2
0
        public async Task Compress_WithFlatEnabled_ShouldZipFolder()
        {
            await FileTool.CreateTempTextFile(sourceDirectoryPath, "compress.txt", fileContent : "compress");

            var subDirectoryPath = Path.Combine(sourceDirectoryPath, Guid.NewGuid().ToString());

            Directory.CreateDirectory(subDirectoryPath);
            await FileTool.CreateTempTextFile(subDirectoryPath, "compress-sub.txt", fileContent : "compress-sub");

            zipFilePath = await fileZipper.Compress(sourceDirectoryPath, flat : true);

            Debugger.Break();

            FileAssert.Exists(zipFilePath);
            FileAssert.ZipHasFiles(zipFilePath, expectedFileCount: 2);
        }