コード例 #1
0
        public void OverwriteFiles()
        {
            sp.SourceFile = Path.Combine(inputPath, @"testzip.zip");
            Options opt = new Options()
            {
                DestinationFileExistsAction = FileExistAction.Overwrite,
                CreateDestinationDirectory  = true
            };

            dp.DirectoryPath = Path.Combine(dp.DirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory"));

            //extract testzip.zip
            Unzip.Output output = UnzipTask.ExtractArchive(sp, dp, opt, new CancellationToken());
            //read first line from each file
            var lines = Directory.EnumerateFiles(dp.DirectoryPath, "*", SearchOption.AllDirectories).Select(x => File.ReadLines(x).First()).ToList();

            Assert.True(lines.Contains("First file") && lines.Contains("Second file") && lines.Contains("Third file"));

            sp.SourceFile = Path.Combine(inputPath, @"testzip2.zip");
            //Extract testzip2.zip. Should overwrite existing files from previous step
            output = UnzipTask.ExtractArchive(sp, dp, opt, new CancellationToken());
            var lines2 = Directory.EnumerateFiles(dp.DirectoryPath, "*", SearchOption.AllDirectories).Select(x => File.ReadLines(x).First()).ToList();

            Assert.False(lines2.Contains("First file") && lines2.Contains("Second file") && lines2.Contains("Third file"));
            Assert.True(lines2.Contains("Fourth file") && lines2.Contains("Fifth file") && lines2.Contains("Sixth file"));
        }
コード例 #2
0
        public GitInstallationState ExtractGit(GitInstallationState state)
        {
            var tempZipExtractPath = SPath.CreateTempDirectory("git_zip_extract_zip_paths");

            if (state.GitZipExists && !state.GitIsValid)
            {
                var gitExtractPath = tempZipExtractPath.Combine("git").CreateDirectory();
                var unzipTask      = new UnzipTask(Token, installDetails.GitZipPath, gitExtractPath,
                                                   sharpZipLibHelper, environment.FileSystem)
                                     .Progress(progressReporter.UpdateProgress)
                                     .Catch(e => {
                    LogHelper.Trace(e, "Failed to unzip " + installDetails.GitZipPath);
                    return(true);
                });

                unzipTask.RunSynchronously();
                var target = state.GitInstallationPath;
                if (unzipTask.Successful)
                {
                    Logger.Trace("Moving Git source:{0} target:{1}", gitExtractPath.ToString(), target.ToString());

                    UpdateTask("Copying git", 100);
                    CopyHelper.Copy(gitExtractPath, target);
                    UpdateTask("Copying git", 100);

                    state.GitIsValid = true;

                    state.IsCustomGitPath = state.GitExecutablePath != installDetails.GitExecutablePath;
                }
            }

            tempZipExtractPath.DeleteIfExists();
            return(state);
        }
コード例 #3
0
ファイル: UnzipTaskTests.cs プロジェクト: Lw960201/Unity-1
        public void TaskFailsWhenMD5Incorect()
        {
            InitializeTaskManager();

            var cacheContainer = Substitute.For <ICacheContainer>();

            Environment = new IntegrationTestEnvironment(cacheContainer, TestBasePath, SolutionDirectory);

            var destinationPath = TestBasePath.Combine("git_zip").CreateDirectory();
            var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", destinationPath, Environment);

            var extractedPath = TestBasePath.Combine("git_zip_extracted").CreateDirectory();


            var       failed    = false;
            Exception exception = null;

            var unzipTask = new UnzipTask(CancellationToken.None, archiveFilePath, extractedPath, Environment.FileSystem, "AABBCCDD")
                            .Finally((b, ex) => {
                failed    = true;
                exception = ex;
            });

            unzipTask.Start().Wait();

            extractedPath.DirectoryExists().Should().BeFalse();
            failed.Should().BeTrue();
            exception.Should().NotBeNull();
            exception.Should().BeOfType <UnzipTaskException>();
        }
コード例 #4
0
ファイル: UnzipTaskTests.cs プロジェクト: Lw960201/Unity-1
        public void TaskSucceeds()
        {
            InitializeTaskManager();

            var cacheContainer = Substitute.For <ICacheContainer>();

            Environment = new IntegrationTestEnvironment(cacheContainer, TestBasePath, SolutionDirectory);

            var destinationPath = TestBasePath.Combine("git_zip").CreateDirectory();
            var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", destinationPath, Environment);

            var extractedPath = TestBasePath.Combine("git_zip_extracted").CreateDirectory();

            var zipProgress = 0;

            Logger.Trace("Pct Complete {0}%", zipProgress);
            var unzipTask = new UnzipTask(CancellationToken.None, archiveFilePath, extractedPath, Environment.FileSystem, GitInstallDetails.GitExtractedMD5,
                                          new Progress <float>(zipFileProgress => {
                var zipFileProgressInteger = (int)(zipFileProgress * 100);
                if (zipProgress != zipFileProgressInteger)
                {
                    zipProgress = zipFileProgressInteger;
                    Logger.Trace("Pct Complete {0}%", zipProgress);
                }
            }));

            unzipTask.Start().Wait();

            extractedPath.DirectoryExists().Should().BeTrue();
        }
コード例 #5
0
 public void SourceFileDoesNotExist()
 {
     //throws System.IO.FileNotFoundException
     sp.SourceFile = Path.Combine(inputPath, @"doesnotexist.zip");
     opt.DestinationFileExistsAction = FileExistAction.Overwrite;
     dp.DirectoryPath = outputPath;
     Assert.That(() => UnzipTask.ExtractArchive(sp, dp, opt, new System.Threading.CancellationToken()), Throws.TypeOf <FileNotFoundException>());
 }
コード例 #6
0
        public void PasswordError()
        {
            //Should throw Ionic.Zip.BadPasswordException
            sp.SourceFile = Path.Combine(inputPath, @"HiQLogosWithPassword.zip");
            opt.DestinationFileExistsAction = FileExistAction.Overwrite;
            opt.CreateDestinationDirectory  = true;
            dp.DirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory");

            Assert.That(() => UnzipTask.ExtractArchive(sp, dp, opt, new System.Threading.CancellationToken()), Throws.TypeOf <BadPasswordException>());
        }
コード例 #7
0
 public void DestinatioDirectoryNotFound()
 {
     //throws directory not found exception
     //destination directory does not exist and create destination directory == false
     sp.SourceFile = Path.Combine(inputPath, @"HiQLogos.zip");
     opt.DestinationFileExistsAction = FileExistAction.Error;
     opt.CreateDestinationDirectory  = false;
     dp.DirectoryPath = Path.Combine(outputPath, @"\doesnot\exist");
     Assert.That(() => UnzipTask.ExtractArchive(sp, dp, opt, new System.Threading.CancellationToken()), Throws.TypeOf <DirectoryNotFoundException>());
 }
コード例 #8
0
        public async Task UnzipWorks()
        {
            var cacheContainer = Substitute.For <ICacheContainer>();

            using (var test = StartTest(cacheContainer: cacheContainer))
            {
                var expectedContent = @"Yup this is

{
  good énough
}
".Replace("\r\n", "\n");

                var destinationPath = test.TestPath.Combine("unziptests").CreateDirectory();
                var localCache      = test.SourceDirectory.Combine("UnzipTestResources");
                var archiveFilePath = localCache.Combine("testfile.zip");
                var extractedPath   = test.TestPath.Combine("zipextract").CreateDirectory();

                var unzipTask = new UnzipTask(test.TaskManager, archiveFilePath, extractedPath, ZipHelper.Instance);

                await unzipTask.StartAwait();

                var expectedFile = extractedPath.Combine("embedded-git.json");
                expectedFile.Parent.DirectoryExists().Should().BeTrue();
                expectedFile.FileExists().Should().BeTrue();
                var actualContent = expectedFile.ReadAllText();
                actualContent.Should().Be(expectedContent);

                extractedPath   = test.TestPath.Combine("tgzextract").CreateDirectory();
                archiveFilePath = localCache.Combine("testfile.tgz");

                unzipTask = new UnzipTask(test.TaskManager, archiveFilePath, extractedPath, ZipHelper.Instance);

                await unzipTask.StartAwait();

                expectedFile = extractedPath.Combine("embedded-git.json");
                expectedFile.Parent.DirectoryExists().Should().BeTrue();
                expectedFile.FileExists().Should().BeTrue();
                expectedFile.ReadAllText().Should().Be(expectedContent);

                extractedPath   = test.TestPath.Combine("targzextract").CreateDirectory();
                archiveFilePath = localCache.Combine("testfile.tar.gz");

                unzipTask = new UnzipTask(test.TaskManager, archiveFilePath, extractedPath, ZipHelper.Instance);

                await unzipTask.StartAwait();

                expectedFile = extractedPath.Combine("embedded-git.json");
                expectedFile.Parent.DirectoryExists().Should().BeTrue();
                expectedFile.FileExists().Should().BeTrue();
                expectedFile.ReadAllText().Should().Be(expectedContent);
            }
        }
コード例 #9
0
        public void ExtractWithPassword()
        {
            //extract password protected archive
            sp.SourceFile = Path.Combine(inputPath, @"HiQLogosWithPassword.zip");
            sp.Password   = "******";

            opt.DestinationFileExistsAction = FileExistAction.Overwrite;
            opt.CreateDestinationDirectory  = true;

            dp.DirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory");

            Output output = UnzipTask.ExtractArchive(sp, dp, opt, new System.Threading.CancellationToken());

            Assert.True(File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory\logo1.png")));
            Assert.True(File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory\logo2.png")));
        }
コード例 #10
0
        public void OptimizeZipThenUnzipTest()
        {
            ICopier copier = new Copier(Context);
            IZipper zipper = new Zipper(Context);
            IDirectoryFilesLister directoryFilesLister = new DirectoryFilesLister();
            StandardPackageDef    packageDef           = new StandardPackageDef();
            DirectorySource       test  = new DirectorySource(Context, directoryFilesLister, "test", new FullPath("tmp/test"));
            DirectorySource       test2 = new DirectorySource(Context, directoryFilesLister, "test2", new FullPath("tmp/test2"));

            packageDef.AddFilesSource(test);
            packageDef.AddFilesSource(test2);
            CopyProcessor copyProcessor = new CopyProcessor(
                Context,
                copier,
                new FullPath("tmp/output"));

            copyProcessor
            .AddTransformation("test", new LocalPath(@"test"))
            .AddTransformation("test2", new LocalPath(@"test2"));
            IPackageDef copiedPackageDef = copyProcessor.Process(packageDef);

            ZipProcessor zipProcessor = new ZipProcessor(Context, zipper, new FileFullPath("tmp/test.zip"), new FullPath("tmp/output"), true, null, "test", "test2");

            zipProcessor.Process(copiedPackageDef);
            string zf = "tmp/test.zip";

            using (ZipArchive archive = ZipFile.OpenRead(zf))
            {
                Assert.Equal(4, archive.Entries.Count);
                var list = archive.Entries.ToList <ZipArchiveEntry>();
                Assert.Contains(list, x => x.FullName == $"test2{_seperator}test.txt");
                Assert.Contains(list, x => x.FullName == $"test2{_seperator}test2.txt");
                Assert.Contains(list, x => x.FullName == $"test{_seperator}test2.txt");
                Assert.Contains(list, x => x.FullName == "_zipmetadata.json");
            }

            string    unzipPath = "tmp/tt/";
            UnzipTask unzip     = new UnzipTask(zf, unzipPath);

            unzip.Execute(Context);
            var newLine = System.Environment.NewLine;

            CheckTestFile(Path.Combine(unzipPath, $"test2{_seperator}test.txt"), $"test.txt{newLine}");
            CheckTestFile(Path.Combine(unzipPath, $"test2{_seperator}test2.txt"), $"test.txt{newLine}");
            CheckTestFile(Path.Combine(unzipPath, $"test{_seperator}test.txt"), $"test.txt{newLine}");
            CheckTestFile(Path.Combine(unzipPath, $"test{_seperator}test2.txt"), $"test2.txt{newLine}");
        }
コード例 #11
0
        public void OptimizeZipThenUnzipTest()
        {
            ICopier copier = new Copier(Context);
            IZipper zipper = new Zipper(Context);
            IDirectoryFilesLister directoryFilesLister = new DirectoryFilesLister();
            StandardPackageDef    packageDef           = new StandardPackageDef();
            DirectorySource       test  = new DirectorySource(Context, directoryFilesLister, "test", new FullPath("tmp\\test"));
            DirectorySource       test2 = new DirectorySource(Context, directoryFilesLister, "test2", new FullPath("tmp\\test2"));

            packageDef.AddFilesSource(test);
            packageDef.AddFilesSource(test2);
            CopyProcessor copyProcessor = new CopyProcessor(
                Context,
                copier,
                new FullPath("tmp\\output"));

            copyProcessor
            .AddTransformation("test", new LocalPath(@"test"))
            .AddTransformation("test2", new LocalPath(@"test2"));
            IPackageDef copiedPackageDef = copyProcessor.Process(packageDef);

            ZipProcessor zipProcessor = new ZipProcessor(Context, zipper, new FileFullPath("tmp\\test.zip"), new FullPath("tmp\\output"), true, null, "test", "test2");

            zipProcessor.Process(copiedPackageDef);
            string zf = "tmp\\test.zip";

            using (ZipArchive archive = ZipFile.OpenRead(zf))
            {
                Assert.Equal(4, archive.Entries.Count);
                Assert.Equal("test2\\test.txt", archive.Entries[1].FullName);
                Assert.Equal("test2\\test2.txt", archive.Entries[0].FullName);
                Assert.Equal("test\\test2.txt", archive.Entries[2].FullName);
                Assert.Equal("_zipmetadata.json", archive.Entries[3].FullName);
            }

            string    unzipPath = "tmp/tt/";
            UnzipTask unzip     = new UnzipTask(zf, unzipPath);

            unzip.Execute(Context);

            CheckTestFile(Path.Combine(unzipPath, "test2\\test.txt"), "test.txt\r\n");
            CheckTestFile(Path.Combine(unzipPath, "test2\\test2.txt"), "test.txt\r\n");
            CheckTestFile(Path.Combine(unzipPath, "test\\test.txt"), "test.txt\r\n");
            CheckTestFile(Path.Combine(unzipPath, "test\\test2.txt"), "test2.txt\r\n");
        }
コード例 #12
0
        public void CreateDirectory()
        {
            //create destination directory if it does not exist
            sp.SourceFile = Path.Combine(inputPath, @"HiQLogos.zip");
            opt.DestinationFileExistsAction = FileExistAction.Error;
            opt.CreateDestinationDirectory  = true;
            dp.DirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory\");

            outputFiles = new List <string>();
            fileNames.ToList().ForEach(x => outputFiles.Add(Path.Combine(dp.DirectoryPath, x)));
            Output output = UnzipTask.ExtractArchive(sp, dp, opt, new CancellationToken());

            foreach (string s in outputFiles)
            {
                Assert.True(File.Exists(s));
            }
            Assert.AreEqual(output.ExtractedFiles.Count, 7);
        }
コード例 #13
0
        public void ThrowErrorOnOverwrite()
        {
            sp.SourceFile = Path.Combine(inputPath, @"HiQLogos.zip");

            Options opt2 = new Options()
            {
                DestinationFileExistsAction = FileExistAction.Overwrite,
                CreateDestinationDirectory  = true
            };

            opt.DestinationFileExistsAction = FileExistAction.Error;
            opt.CreateDestinationDirectory  = true;

            dp.DirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestData\TestOut\new_directory");

            //unzip files to TestOut, so that there are existing files
            UnzipTask.ExtractArchive(sp, dp, opt2, new CancellationToken());

            Assert.That(() => UnzipTask.ExtractArchive(sp, dp, opt, new System.Threading.CancellationToken()), Throws.TypeOf <Ionic.Zip.ZipException>());
        }
コード例 #14
0
        protected void SetupGit(NPath pathToSetupGitInto, string testName)
        {
            var installDetails = new GitInstaller.GitInstallDetails(pathToSetupGitInto, Environment.IsWindows);
            var gitInstaller   = new GitInstaller(Environment, ProcessManager, TaskManager.Token, installDetails);
            var state          = gitInstaller.SetDefaultPaths(new GitInstaller.GitInstallationState());

            Environment.GitInstallationState = state;
            GitClient = new GitClient(Environment, ProcessManager, TaskManager.Token);

            if (installDetails.GitExecutablePath.FileExists() && installDetails.GitLfsExecutablePath.FileExists())
            {
                return;
            }

            installDetails.GitInstallationPath.DeleteIfExists();

            installDetails.GitZipPath.EnsureParentDirectoryExists();
            installDetails.GitLfsZipPath.EnsureParentDirectoryExists();

            AssemblyResources.ToFile(ResourceType.Platform, "git.zip", installDetails.GitZipPath.Parent, Environment);
            AssemblyResources.ToFile(ResourceType.Platform, "git.json", installDetails.GitZipPath.Parent, Environment);
            AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", installDetails.GitZipPath.Parent, Environment);
            AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.json", installDetails.GitZipPath.Parent, Environment);

            var tempZipExtractPath = TestBasePath.Combine("setup", "git_zip_extract_zip_paths").EnsureDirectoryExists();
            var extractPath        = tempZipExtractPath.Combine("git").CreateDirectory();
            var path = new UnzipTask(TaskManager.Token, installDetails.GitZipPath, extractPath, null, Environment.FileSystem)
                       .Catch(e => true)
                       .RunSynchronously();
            var source = path;

            installDetails.GitInstallationPath.EnsureParentDirectoryExists();
            source.Move(installDetails.GitInstallationPath);

            extractPath = tempZipExtractPath.Combine("git-lfs").CreateDirectory();
            path        = new UnzipTask(TaskManager.Token, installDetails.GitLfsZipPath, extractPath, null, Environment.FileSystem)
                          .Catch(e => true)
                          .RunSynchronously();
            installDetails.GitLfsInstallationPath.EnsureParentDirectoryExists();
            path.Move(installDetails.GitLfsInstallationPath);
        }
コード例 #15
0
        protected void SetupGit(NPath pathToSetupGitInto, string testName)
        {
            var installDetails = new GitInstaller.GitInstallDetails(pathToSetupGitInto, Environment);
            var state          = installDetails.GetDefaults();

            Environment.GitInstallationState = state;
            GitClient = new GitClient(Environment, ProcessManager, TaskManager.Token);

            if (installDetails.GitExecutablePath.FileExists() && installDetails.GitLfsExecutablePath.FileExists())
            {
                return;
            }

            var key = installDetails.GitManifest.FileNameWithoutExtension + "_updatelastCheckTime";

            Environment.UserSettings.Set(key, DateTimeOffset.Now);

            var localCache = TestLocation.Combine("Resources");

            localCache.CopyFiles(pathToSetupGitInto, true);
            // skip checking for updates

            state.GitPackage = DugiteReleaseManifest.Load(installDetails.GitManifest, GitInstaller.GitInstallDetails.GitPackageFeed, Environment);
            var asset = state.GitPackage.DugitePackage;

            state.GitZipPath = installDetails.ZipPath.Combine(asset.Name);

            installDetails.GitInstallationPath.DeleteIfExists();

            state.GitZipPath.EnsureParentDirectoryExists();

            var gitExtractPath = TestBasePath.Combine("setup", "git_zip_extract_zip_paths").EnsureDirectoryExists();
            var source         = new UnzipTask(TaskManager.Token, state.GitZipPath, gitExtractPath, null, Environment.FileSystem)
                                 .RunSynchronously();

            installDetails.GitInstallationPath.EnsureParentDirectoryExists();
            source.Move(installDetails.GitInstallationPath);
        }
コード例 #16
0
        public void InstallTestGit()
        {
            var installDetails = Environment.GitDefaultInstallation;
            var state          = installDetails.GetDefaults();

            Environment.GitInstallationState = state;

            if (installDetails.GitExecutablePath.FileExists() && installDetails.GitLfsExecutablePath.FileExists())
            {
                return;
            }

            var key = installDetails.GitManifest.FileNameWithoutExtension + "_updatelastCheckTime";

            Environment.UserSettings.Set(key, DateTimeOffset.Now);

            var localCache = SourceDirectory.Combine("files/git");

            localCache.CopyFiles(installDetails.ZipPath.Parent, true);
            // skip checking for updates

            state.GitPackage = DugiteReleaseManifest.Load(TaskManager, installDetails.GitManifest,
                                                          GitInstaller.GitInstallDetails.ManifestFeed, Environment);
            var asset = state.GitPackage.DugitePackage;

            state.GitZipPath = installDetails.ZipPath.Combine(asset.Name);

            installDetails.GitInstallationPath.DeleteIfExists();

            state.GitZipPath.EnsureParentDirectoryExists();

            var gitExtractPath = TestPath.Combine("setup", "git_zip_extract_zip_paths").EnsureDirectoryExists();
            var source         = new UnzipTask(TaskManager, state.GitZipPath, gitExtractPath)
                                 .RunSynchronously();

            installDetails.GitInstallationPath.EnsureParentDirectoryExists();
            source.Move(installDetails.GitInstallationPath);
        }
コード例 #17
0
        public async Task UnzipWorks()
        {
            var cacheContainer = Substitute.For <ICacheContainer>();

            Environment = new IntegrationTestEnvironment(cacheContainer, TestBasePath, SolutionDirectory);
            InitializeTaskManager();

            var destinationPath = TestBasePath.Combine("gitlfs_zip").CreateDirectory();
            var archiveFilePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", destinationPath, Environment);

            var extractedPath = TestBasePath.Combine("gitlfs_zip_extracted").CreateDirectory();

            var unzipTask = new UnzipTask(CancellationToken.None, archiveFilePath, extractedPath,
                                          ZipHelper.Instance,
                                          Environment.FileSystem)
                            .Progress(p =>
            {
            });

            await unzipTask.StartAwait();

            extractedPath.DirectoryExists().Should().BeTrue();
        }
コード例 #18
0
        public void RenameFiles()
        {
            sp.SourceFile = Path.Combine(inputPath, @"HiQLogos.zip");

            opt.DestinationFileExistsAction = FileExistAction.Rename;
            opt.CreateDestinationDirectory  = true;

            dp.DirectoryPath = outputPath;

            //extract files to TestOut, so that there are existing files
            UnzipTask.ExtractArchive(sp, dp, opt, new CancellationToken());
            Output output = UnzipTask.ExtractArchive(sp, dp, opt, new CancellationToken());

            //create filenames to test against
            outputFiles = new List <string>();
            renamedFilenames.ToList().ForEach(x => outputFiles.Add(Path.Combine(dp.DirectoryPath, x)));

            foreach (string s in outputFiles)
            {
                Assert.True(File.Exists(s));
            }

            Assert.AreEqual(output.ExtractedFiles.Count, 7);
        }
コード例 #19
0
        public async Task UnzipWorks()
        {
            var cacheContainer = Substitute.For <ICacheContainer>();

            Environment = new IntegrationTestEnvironment(cacheContainer, TestBasePath, SolutionDirectory, new CreateEnvironmentOptions(TestBasePath));
            InitializeTaskManager();

            var expectedContent = @"Yup this is

{
  good énough
}
".Replace("\r\n", "\n");

            var destinationPath = TestBasePath.Combine("unziptests").CreateDirectory();
            var localCache      = TestLocation.Combine("UnzipTestResources");
            var archiveFilePath = localCache.Combine("testfile.zip");
            var extractedPath   = TestBasePath.Combine("zipextract").CreateDirectory();

            var unzipTask = new UnzipTask(CancellationToken.None, archiveFilePath, extractedPath,
                                          ZipHelper.Instance,
                                          Environment.FileSystem);

            await unzipTask.StartAwait();

            var expectedFile = extractedPath.Combine("embedded-git.json");

            expectedFile.Parent.DirectoryExists().Should().BeTrue();
            expectedFile.FileExists().Should().BeTrue();
            var actualContent = expectedFile.ReadAllText();

            actualContent.Should().Be(expectedContent);

            extractedPath   = TestBasePath.Combine("tgzextract").CreateDirectory();
            archiveFilePath = localCache.Combine("testfile.tgz");

            unzipTask = new UnzipTask(CancellationToken.None, archiveFilePath, extractedPath,
                                      ZipHelper.Instance,
                                      Environment.FileSystem);

            await unzipTask.StartAwait();

            expectedFile = extractedPath.Combine("embedded-git.json");
            expectedFile.Parent.DirectoryExists().Should().BeTrue();
            expectedFile.FileExists().Should().BeTrue();
            expectedFile.ReadAllText().Should().Be(expectedContent);

            extractedPath   = TestBasePath.Combine("targzextract").CreateDirectory();
            archiveFilePath = localCache.Combine("testfile.tar.gz");

            unzipTask = new UnzipTask(CancellationToken.None, archiveFilePath, extractedPath,
                                      ZipHelper.Instance,
                                      Environment.FileSystem);

            await unzipTask.StartAwait();

            expectedFile = extractedPath.Combine("embedded-git.json");
            expectedFile.Parent.DirectoryExists().Should().BeTrue();
            expectedFile.FileExists().Should().BeTrue();
            expectedFile.ReadAllText().Should().Be(expectedContent);
        }