コード例 #1
0
        public void ShouldGetExpectedZipFilePath()
        {
            // setup
            var folderTozipPath = Support.Fixture.FirstFolderToZipPath;
            var destinationPath = Support.Fixture.OutputFolder;

            var expectedZipFilePath = Support.FileSystem.GetZipFilePathFrom(folderTozipPath, destinationPath);

            // run
            var SUT = new ZipValidator(folderTozipPath, destinationPath);
            var actualZipFilePath = SUT.GetZipFilePath();

            // assert
            Assert.That(actualZipFilePath, Is.EqualTo(expectedZipFilePath));
        }
コード例 #2
0
        private bool ZipSubFolder(string subFolderPath, string destinationPath, CancellationToken token)
        {
            if (!Directory.Exists(subFolderPath))
            {
                return(false);
            }

            var zipValidator = new ZipValidator(subFolderPath, destinationPath);
            var zipPath      = zipValidator.GetZipFilePath();

            if (!zipValidator.ZipFileCanBeCreated())
            {
                return(false);
            }

            new Zipper(subFolderPath, zipPath).ZipFolder(token);
            return(true);
        }