Exemplo n.º 1
0
        public void FileCompressorZipsSamplePackageDirectoryToValidArchive()
        {
            var executingLocation = new DirectoryInfo(Assembly.GetExecutingAssembly().Location);
            var testDirectory     = Path.Combine(executingLocation.Parent.Parent.Parent.Parent.FullName, "test");
            var aPackagePath      = new DirectoryInfo(Path.Combine(testDirectory, "pkgs", "sampleExtension"));
            var allFiles          = aPackagePath.GetFiles("*", SearchOption.AllDirectories);
            var preZipfileCount   = allFiles.Count();
            var preZipDiskSize    = allFiles.Sum(x => x.Length);
            var preZipMD5Map      = allFiles.ToDictionary(file => file.Name, file => ComputeHash(file.FullName));

            var packageDir = new directoryTestClass()
            {
                FullName = aPackagePath.FullName
            };

            var compressor = new MutatingFileCompressor();
            var zipPath    = compressor.Zip(packageDir);

            //unzip the zipped directory
            var unzipPath         = Greg.Utility.FileUtilities.UnZip(zipPath.Name);
            var unzippedDirectory = new DirectoryInfo(unzipPath);
            var allUnzippedFiles  = unzippedDirectory.GetFiles("*", SearchOption.AllDirectories);

            var postZipMD5Map = allUnzippedFiles.ToDictionary(file => file.Name, file => ComputeHash(file.FullName));

            Assert.AreEqual(preZipDiskSize, allUnzippedFiles.Sum(x => x.Length));
            Assert.AreEqual(preZipfileCount, allUnzippedFiles.Length);
            foreach (var pair in preZipMD5Map)
            {
                Console.WriteLine(pair);
                Assert.AreEqual(pair.Value, postZipMD5Map[pair.Key]);
            }
        }
Exemplo n.º 2
0
 public PublishCommands(PackageLoader loader, DynamoModel model)
 {
     fileCompressor = new MutatingFileCompressor();
     //customNodeDefinitions = new List<CustomNodeDefinition>();
     //Dependencies = new List<PackageDependency>();
     //Assemblies = new List<PackageAssembly>();
     //PackageAssemblyNodes = new List<TypeLoadData>();
     //FilesToUpload = new List<string>();
 }
Exemplo n.º 3
0
 public PublishCefHelper(DynamoViewModel dynamoViewModel, PackageLoader model, PackageManagerViewModel pkgManagerViewModel) : base(dynamoViewModel, model, pkgManagerViewModel)
 {
     fileCompressor = new MutatingFileCompressor();
     //customNodeDefinitions = new List<CustomNodeDefinition>();
     //Dependencies = new List<PackageDependency>();
     //Assemblies = new List<PackageAssembly>();
     //PackageAssemblyNodes = new List<TypeLoadData>();
     //FilesToUpload = new List<string>();
 }