public void Setup() { // initialize mock ModulesRepository = new Mock <IModulesRepository>(); ModulesOperations = new Mock <IModulesOperations>(); ModuleDiscovery = new Mock <IModuleDiscovery>(); ModuleManifestFactory = new Mock <IModuleManifestFactory>(); EventAggregator = new Mock <IEventAggregator>(MockBehavior.Loose); DependencyChecker = new Mock <IDependencyChecker>(MockBehavior.Loose); ModulePackager = new Mock <IModulePackager>(); ModuleFinder = new Mock <IModuleFinder>(); PluginsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UpdateTests"); // directory clean up if (Directory.Exists(PluginsDir)) { Directory.Delete(PluginsDir, true); } Directory.CreateDirectory(PluginsDir); NomadUpdater = new NomadUpdater(PluginsDir, ModulesRepository.Object, ModulesOperations.Object, EventAggregator.Object, ModulePackager.Object, DependencyChecker.Object, ModuleFinder.Object); }
private void SetupUpdater() { var asmName = typeof(Operations).Assembly.FullName; var typeName = typeof(Operations).FullName; var instance = Activator.CreateInstance(_appdomain, asmName, typeName); _nomadUpdater = (instance.Unwrap() as Operations).NomadUpdater; }
public void Setup() { // initialize mock ModulesRepository = new Mock<IModulesRepository>(); ModulesOperations = new Mock<IModulesOperations>(); ModuleDiscovery = new Mock<IModuleDiscovery>(); ModuleManifestFactory = new Mock<IModuleManifestFactory>(); EventAggregator = new Mock<IEventAggregator>(MockBehavior.Loose); DependencyChecker = new Mock<IDependencyChecker>(MockBehavior.Loose); ModulePackager = new Mock<IModulePackager>(); ModuleFinder = new Mock<IModuleFinder>(); PluginsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UpdateTests"); // directory clean up if (Directory.Exists(PluginsDir)) Directory.Delete(PluginsDir, true); Directory.CreateDirectory(PluginsDir); NomadUpdater = new NomadUpdater(PluginsDir, ModulesRepository.Object, ModulesOperations.Object,EventAggregator.Object, ModulePackager.Object,DependencyChecker.Object, ModuleFinder.Object); }
private void RegisterAdditionalServices() { // registering updater using data from configuration // TODO: maybe changing the event aggregator not to be passed via constructor var updater = new NomadUpdater(KernelConfiguration.ModuleDirectoryPath, KernelConfiguration.ModuleRepository, this, EventAggregator, KernelConfiguration.ModulePackager, KernelConfiguration.DependencyChecker, KernelConfiguration.ModuleFinder) {Mode = KernelConfiguration.UpdaterType}; // FIXME this into construcot of the updater ? ServiceLocator.Register<IUpdater>(updater); // registering LoadedModulesService ServiceLocator.Register<ILoadedModulesService>( new LoadedModulesService(ModuleLoader)); }
public Operations() { var targetDirectory = AppDomain.CurrentDomain.BaseDirectory; var modulesRepository = new Mock<IModulesRepository>(); modulesRepository.Setup(x => x.GetAvailableModules()).Returns( new AvailableModules(new List<ModuleManifest>())); var modulesOperations = new Mock<IModulesOperations>(); var modulesFinder = new Mock<IModuleFinder>(); var eventAggregator = new Mock<IEventAggregator>(); var dependencyChecker = new Mock<IDependencyChecker>(); var packager = new Mock<IModulePackager>(); NomadUpdater = new NomadUpdater(targetDirectory, modulesRepository.Object, modulesOperations.Object, eventAggregator.Object, packager.Object, dependencyChecker.Object,modulesFinder.Object); }