Пример #1
0
        public void TestZipHelper(string input, bool expectedOutput)
        {
            Assert.AreEqual(expectedOutput, ZipHelper.IsZip(input));

            var fs = new System.IO.Abstractions.FileSystem();
            var fi = new System.IO.Abstractions.FileInfoWrapper(fs, new FileInfo(input));

            Assert.AreEqual(expectedOutput, ZipHelper.IsZip(fi));
        }
        public void Is_Serializable()
        {
            var fileSystem = new System.IO.Abstractions.FileSystem();
            var memoryStream = new System.IO.MemoryStream();

            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            serializer.Serialize(memoryStream, fileSystem);

            Assert.That(memoryStream.Length > 0, "Length didnt increase after serialization task.");
        }
Пример #3
0
 public static ModuleInstaller GetModuleInstaller(string discoveryPath, string probingPath, string authToken, IEnumerable <string> manifestUrls)
 {
     if (_moduleInstaller == null)
     {
         var fileManager           = new TransactionFileManager();
         var fileSystem            = new System.IO.Abstractions.FileSystem();
         var zipFileWrapper        = new ZipFileWrapper(fileSystem, fileManager);
         var localCatalogOptions   = LocalModuleCatalog.GetOptions(discoveryPath, probingPath);
         var extCatalogOptions     = ExtModuleCatalog.GetOptions(authToken, manifestUrls);
         var localModuleCatalog    = LocalModuleCatalog.GetCatalog(localCatalogOptions);
         var externalModuleCatalog = ExtModuleCatalog.GetCatalog(extCatalogOptions, localModuleCatalog);
         var modulesClient         = new ExternalModulesClient(extCatalogOptions);
         _moduleInstaller = new ModuleInstaller(externalModuleCatalog, modulesClient, fileManager, localCatalogOptions, fileSystem, zipFileWrapper);
     }
     return(_moduleInstaller);
 }
Пример #4
0
        public void Push()
        {
            // Run the synchronisers.

            var fileSystem = new System.IO.Abstractions.FileSystem();
            lock (_tasks)
            {
                // clone list and then pass it to new thread for processing?
                foreach (KeyValuePair<string, string> kvp in _tasks)
                {
                    Pusher.PushFile(fileSystem, kvp.Key, kvp.Value);
                    //_filePushTasks.Remove(kvp.Key);
                }
                _tasks.Clear();
            }
            // kick off new thread which runs through list?
        }