Esempio n. 1
0
        private void InitializeStorage(StorageType sourceStorageType, StorageType destinationStorageType)
        {
            IStorageFactory sourceFactory      = _storageFactoryFactory.CreateStorageFactory(TargetStorage.Source);
            IStorageFactory destinationFactory = _storageFactoryFactory.CreateStorageFactory(TargetStorage.Destination);
            var             storageConfigModel = _configurationService.GetStorageConfigModel();

            _sourceStorageService      = sourceFactory.CreateStorageService(sourceStorageType, storageConfigModel);
            _destinationStorageService = destinationFactory.CreateStorageService(destinationStorageType, storageConfigModel);
        }
Esempio n. 2
0
        static async Task SetupAndRunTests(this IStorageFactory storageFactory, TimeSpan?withDelay = null)
        {
            using var folderChangeWatcher = storageFactory.CreateChangeWatcher();
            using var subscription        = folderChangeWatcher.FolderChanged.Subscribe(path =>
            {
                Console.ForegroundColor = ConsoleColor.DarkMagenta;
                Console.WriteLine($"File in folder '{path}' was changed");
                Console.ForegroundColor = ConsoleColor.Black;
            });
            //Task.Run(() => { Thread.Sleep(4000); subscription.Dispose(); Console.WriteLine("subscription cancelled"); });
            await storageFactory.CreateStorageService().RunTestActions(withDelay);

            await Task.Delay(1000);
        }