Пример #1
0
        public void ExploreZip()
        {
            var config     = System.IO.Path.Combine(_testDirectory, "configuration_zip.xml");
            var outputFile = System.IO.Path.Combine(_outputDirectory, "ExploreZip.zip");
            var targets    = CKPackAliases.GetTargetsFromConfigurationFile(_context, config);

            CKPackAliases.Pack(_context, targets, outputFile, true);

            CheckZipContent(outputFile, new[] {
                @"Sub1\ZipFileSub1.txt",
                @"Sub1\Sub2\ZipFileSub2.txt",
                @"Sub1\Sub2\ZipFileSub2-2.txt"
            });
        }
Пример #2
0
        public void PackFromConfigurationFile()
        {
            var config     = System.IO.Path.Combine(_testDirectory, "configuration.xml");
            var outputFile = System.IO.Path.Combine(_outputDirectory, "PackFromConfigurationFile.zip");
            var targets    = CKPackAliases.GetTargetsFromConfigurationFile(_context, config);

            CKPackAliases.Pack(_context, targets, outputFile);

            Assert.IsTrue(File.Exists(outputFile), "Created zip - Output file not found");

            CheckZipContent(outputFile, new[] {
                "RootFile.txt",
                @"Target1\File1.txt",
                @"Target1\File2.txt",
                @"Target1\ZipContent.zip",
                @"Target3\File5.txt"
            });
        }
Пример #3
0
        public void PackFromList()
        {
            var t1 = new FileGroupTarget()
            {
                Target = "/Target1"
            };
            var fn1 = new FileNameFilter()
            {
                Root = "ForTarget1"
            };
            var pf1 = new PathFilter(true, "/**.txt");

            t1.Filters.Add(fn1);
            fn1.Filters.Add(pf1);

            var t2 = new FileGroupTarget()
            {
                Target = "/Target2"
            };
            var fn2 = new FileNameFilter()
            {
                Root = "ForTarget2"
            };
            var pf2 = new PathFilter(false, "/**.txt");

            t2.Filters.Add(fn2);
            fn2.Filters.Add(pf2);

            var t3 = new FileGroupTarget()
            {
                Target = "/Target3"
            };
            var fn3 = new FileNameFilter()
            {
                Root = "ForTarget3"
            };
            var pf3e = new PathFilter(false, "/File6.txt");
            var pf3i = new PathFilter(true, "/**.txt");

            t3.Filters.Add(fn3);
            fn3.Filters.Add(pf3e);
            fn3.Filters.Add(pf3i);

            var t4 = new FileGroupTarget()
            {
                Target = "/"
            };
            var fn4 = new FileNameFilter()
            {
                Root = "/"
            };
            var pf4 = new PathFilter(true, "/RootFile.txt");

            t4.Filters.Add(fn4);
            fn4.Filters.Add(pf4);

            var targets = new[] { t1, t2, t3, t4 };

            var outputFile = System.IO.Path.Combine(_outputDirectory, "PackFromList.zip");

            CKPackAliases.Pack(_context, targets, outputFile);

            Assert.IsTrue(File.Exists(outputFile), "Created zip - Output file not found");

            CheckZipContent(outputFile, new[] {
                "RootFile.txt",
                @"Target1\File1.txt",
                @"Target1\File2.txt",
                @"Target3\File5.txt"
            });
        }