Beispiel #1
0
        public DirectoryWatcher(IMessageBus bus, IWatchValidator validator, IConfiguration configuration, IHandleDelayedConfiguration delayedConfigurer, IWatchPathLocator watchPathLocator, IApplicatonLauncher launcer, ICache cache, IMarkProjectsForRebuild rebuildMarker, ISolutionChangeConsumer solutionHanlder)
        {
            _bus               = bus;
            _validator         = validator;
            _configuration     = configuration;
            _delayedConfigurer = delayedConfigurer;
            _watchPathLocator  = watchPathLocator;
            _launcer           = launcer;
            _cache             = cache;
            _rebuildMarker     = rebuildMarker;
            _solutionHanlder   = solutionHanlder;
            _watcher           = new FileSystemWatcher
            {
                NotifyFilter          = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.Attributes,
                IncludeSubdirectories = true,
                Filter = "*.*",
            };

            _watcher.Changed += WatcherChangeHandler;
            _watcher.Created += WatcherChangeHandler;
            _watcher.Deleted += WatcherChangeHandler;
            _watcher.Renamed += WatcherChangeHandler;
            _watcher.Error   += WatcherErrorHandler;
            if (!_configuration.StartPaused)
            {
                Resume();
            }
        }
        public DirectoryWatcher(IMessageBus bus, IWatchValidator validator, IConfiguration configuration, IHandleDelayedConfiguration delayedConfigurer, IWatchPathLocator watchPathLocator, IApplicatonLauncher launcer, ICache cache, IMarkProjectsForRebuild rebuildMarker, ISolutionChangeConsumer solutionHanlder)
        {
            _bus = bus;
            _validator = validator;
			_configuration = configuration;
			_delayedConfigurer = delayedConfigurer;
            _watchPathLocator = watchPathLocator;
			_launcer = launcer;
            _cache = cache;
            _rebuildMarker = rebuildMarker;
            _solutionHanlder = solutionHanlder;
            _watcher = new FileSystemWatcher
                           {
                               NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.Attributes,
                               IncludeSubdirectories = true,
                               Filter = "*.*",
                           };
            
            _watcher.Changed += WatcherChangeHandler;
            _watcher.Created += WatcherChangeHandler;
            _watcher.Deleted += WatcherChangeHandler;
            _watcher.Renamed += WatcherChangeHandler;
            _watcher.Error += WatcherErrorHandler;
            if (!_configuration.StartPaused)
                Resume();
        }
 public FileChangeConsumer(IServiceLocator services, IMessageBus bus, IMarkProjectsForRebuild rebuildMarker, ISolutionChangeConsumer solutionHanlder)
 {
     _services        = services;
     _bus             = bus;
     _rebuildMarker   = rebuildMarker;
     _solutionHanlder = solutionHanlder;
 }
        public void testSetup()
        {
            _services = MockRepository.GenerateMock<IServiceLocator>();
            _cache = MockRepository.GenerateMock<ICache>();
            _bus = MockRepository.GenerateMock<IMessageBus>();
			_marker = MockRepository.GenerateMock<IMarkProjectsForRebuild>();
            _subject = new FileChangeConsumer(_services, _bus, _cache, _marker);
        }
        public void testSetup()
        {
            _services = MockRepository.GenerateMock <IServiceLocator>();
            _bus      = MockRepository.GenerateMock <IMessageBus>();
            _marker   = MockRepository.GenerateMock <IMarkProjectsForRebuild>();
            var crawler = MockRepository.GenerateMock <ISolutionChangeConsumer>();

            _subject = new FileChangeConsumer(_services, _bus, _marker, crawler);
        }
		public DirectoryWatcher(IMessageBus bus, IWatchValidator validator, IConfiguration configuration, IHandleDelayedConfiguration delayedConfigurer, IWatchPathLocator watchPathLocator, IApplicatonLauncher launcer, ICache cache, IMarkProjectsForRebuild rebuildMarker, ISolutionChangeConsumer solutionHanlder)
		{
			_bus = bus;
			_validator = validator;
			_configuration = configuration;
			_delayedConfigurer = delayedConfigurer;
			_watchPathLocator = watchPathLocator;
			_launcer = launcer;
			_cache = cache;
			_rebuildMarker = rebuildMarker;
			_solutionHanlder = solutionHanlder;
			if (!_configuration.StartPaused)
				Resume();
		}
 public DirectoryWatcher(IMessageBus bus, IWatchValidator validator, IConfiguration configuration, IHandleDelayedConfiguration delayedConfigurer, IWatchPathLocator watchPathLocator, IApplicatonLauncher launcer, ICache cache, IMarkProjectsForRebuild rebuildMarker, ISolutionChangeConsumer solutionHanlder)
 {
     _bus               = bus;
     _validator         = validator;
     _configuration     = configuration;
     _delayedConfigurer = delayedConfigurer;
     _watchPathLocator  = watchPathLocator;
     _launcer           = launcer;
     _cache             = cache;
     _rebuildMarker     = rebuildMarker;
     _solutionHanlder   = solutionHanlder;
     if (!_configuration.StartPaused)
     {
         Resume();
     }
 }
 public void SetUp()
 {
     _launcer       = MockRepository.GenerateMock <IApplicatonLauncher>();
     _messageBus    = MockRepository.GenerateMock <IMessageBus>();
     _validator     = MockRepository.GenerateMock <IWatchValidator>();
     _configuration = MockRepository.GenerateMock <IConfiguration>();
     _pathLocator   = MockRepository.GenerateMock <IWatchPathLocator>();
     _cahce         = MockRepository.GenerateMock <ICache>();
     _slnConsumer   = MockRepository.GenerateMock <ISolutionChangeConsumer>();
     _rebuildMarker = MockRepository.GenerateMock <IMarkProjectsForRebuild>();
     _configuration.Stub(x => x.IgnoreFile).Return("");
     _validator.Stub(v => v.GetIgnorePatterns()).Return("");
     _configuration.Stub(c => c.FileChangeBatchDelay).Return(50);
     _configuration.Stub(c => c.WatchAllFiles).Return(true);
     _configuration.Stub(c => c.WatchToken).Return(_watchDirectory);
     _watcher        = new DirectoryWatcher(_messageBus, _validator, _configuration, MockRepository.GenerateMock <IHandleDelayedConfiguration>(), _pathLocator, _launcer, _cahce, _rebuildMarker, _slnConsumer);
     _file           = Path.GetFullPath("watcher_test.txt");
     _directory      = Path.GetFullPath("mytestfolder");
     _watchDirectory = Path.GetDirectoryName(_file);
     _pathLocator.Stub(x => x.Locate(_watchDirectory)).Return(_watchDirectory);
     _localConfig = new PathTranslator(_watchDirectory).Translate(Path.Combine(_watchDirectory, "AutoTest.config"));
     File.WriteAllText(_localConfig, "<configuration></configuration>");
 }
        public void SetUp()
        {
			_launcer = MockRepository.GenerateMock<IApplicatonLauncher>();
            _messageBus = MockRepository.GenerateMock<IMessageBus>();
            _validator = MockRepository.GenerateMock<IWatchValidator>();
			_configuration = MockRepository.GenerateMock<IConfiguration>();
            _pathLocator = MockRepository.GenerateMock<IWatchPathLocator>();
            _cahce = MockRepository.GenerateMock<ICache>();
            _slnConsumer = MockRepository.GenerateMock<ISolutionChangeConsumer>();
            _rebuildMarker = MockRepository.GenerateMock<IMarkProjectsForRebuild>();
            _configuration.Stub(x => x.IgnoreFile).Return("");
			_validator.Stub(v => v.GetIgnorePatterns()).Return("");
			_configuration.Stub(c => c.FileChangeBatchDelay).Return(50);
            _configuration.Stub(c => c.WatchAllFiles).Return(true);
            _configuration.Stub(c => c.WatchToken).Return(_watchDirectory);
            _watcher = new DirectoryWatcher(_messageBus, _validator, _configuration, MockRepository.GenerateMock<IHandleDelayedConfiguration>(), _pathLocator, _launcer, _cahce, _rebuildMarker, _slnConsumer);
            _file = Path.GetFullPath("watcher_test.txt");
            _directory = Path.GetFullPath("mytestfolder");
			_watchDirectory = Path.GetDirectoryName(_file);
            _pathLocator.Stub(x => x.Locate(_watchDirectory)).Return(_watchDirectory);
			_localConfig = new PathTranslator(_watchDirectory).Translate(Path.Combine(_watchDirectory, "AutoTest.config"));
			File.WriteAllText(_localConfig, "<configuration></configuration>");
            _watcher.Watch(_watchDirectory);
        }