예제 #1
0
 public Scheduler(ISynchronizerFactory synchronizerFactory)
 {
     _synchronizerFactory           = synchronizerFactory;
     _synchronizationTimer.Tick    += _synchronizationTimer_Tick;
     _synchronizationTimer.Interval = (int)_timerInterval.TotalMilliseconds;
     _synchronizationTimer.Start();
 }
예제 #2
0
        public Scheduler(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportRepository synchronizationReportRepository,
            Action ensureSynchronizationContext)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException("synchronizerFactory");
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException("ensureSynchronizationContext");
            }
            if (synchronizationReportRepository == null)
            {
                throw new ArgumentNullException("synchronizationReportRepository");
            }

            _synchronizationReportRepository = synchronizationReportRepository;
            _synchronizerFactory             = synchronizerFactory;
            _ensureSynchronizationContext    = ensureSynchronizationContext;
            _synchronizationTimer.Tick      += _synchronizationTimer_Tick;
            _synchronizationTimer.Interval   = (int)_timerInterval.TotalMilliseconds;
            _synchronizationTimer.Start();
        }
        public void SetUp()
        {
            _synchronizerFactory          = MockRepository.GenerateStub <ISynchronizerFactory>();
            _dateTimeProvider             = new StubDateTimeProvider();
            _synchronizationReportSink    = new TestSynchronizationReportSink();
            _synchronizationProfileRunner = new SynchronizationProfileRunner(
                _synchronizerFactory,
                _synchronizationReportSink,
                MockRepository.GenerateStub <IFolderChangeWatcherFactory>(),
                delegate { },
                MockRepository.GenerateStub <ISynchronizationRunLogger>(),
                _dateTimeProvider,
                new Guid());

            var logger = MockRepository.GenerateStub <ILog>();

            logger
            .Expect(_ => _.Info(null))
            .IgnoreArguments()
            .WhenCalled(_ => _loggedInfoMessages.Add((string)_.Arguments[0]));
            logger
            .Expect(_ => _.Logger)
            .Return(MockRepository.GenerateStub <ILogger>());

            SetSynchronizationProfileRunnerLogger(logger);
        }
    public SynchronizationProfileRunner (
        ISynchronizerFactory synchronizerFactory,
        ISynchronizationReportSink reportSink,
        IFolderChangeWatcherFactory folderChangeWatcherFactory,
        Action ensureSynchronizationContext, 
        ISynchronizationRunLogger runLogger)
    {
      if (synchronizerFactory == null)
        throw new ArgumentNullException (nameof (synchronizerFactory));
      if (reportSink == null)
        throw new ArgumentNullException (nameof (reportSink));
      if (folderChangeWatcherFactory == null)
        throw new ArgumentNullException (nameof (folderChangeWatcherFactory));
      if (ensureSynchronizationContext == null)
        throw new ArgumentNullException (nameof (ensureSynchronizationContext));
      if (runLogger == null)
        throw new ArgumentNullException (nameof (runLogger));

      _synchronizerFactory = synchronizerFactory;
      _reportSink = reportSink;
      _folderChangeWatcherFactory = folderChangeWatcherFactory;
      _ensureSynchronizationContext = ensureSynchronizationContext;
      _runLogger = runLogger;
      // Set to min, to ensure that it runs on the first run after startup
      _lastRun = DateTime.MinValue;
    }
        public SynchronizationProfileRunner(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportSink reportSink,
            IFolderChangeWatcherFactory folderChangeWatcherFactory,
            Action ensureSynchronizationContext)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException(nameof(synchronizerFactory));
            }
            if (reportSink == null)
            {
                throw new ArgumentNullException(nameof(reportSink));
            }
            if (folderChangeWatcherFactory == null)
            {
                throw new ArgumentNullException(nameof(folderChangeWatcherFactory));
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException(nameof(ensureSynchronizationContext));
            }

            _synchronizerFactory          = synchronizerFactory;
            _reportSink                   = reportSink;
            _folderChangeWatcherFactory   = folderChangeWatcherFactory;
            _ensureSynchronizationContext = ensureSynchronizationContext;
            // Set to min, to ensure that it runs on the first run after startup
            _lastRun = DateTime.MinValue;
        }
 public Scheduler (ISynchronizerFactory synchronizerFactory)
 {
   _synchronizerFactory = synchronizerFactory;
   _synchronizationTimer.Tick += _synchronizationTimer_Tick;
   _synchronizationTimer.Interval = (int) _timerInterval.TotalMilliseconds;
   _synchronizationTimer.Start();
 }
예제 #7
0
        public Scheduler(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportSink reportSink,
            Action ensureSynchronizationContext,
            IFolderChangeWatcherFactory folderChangeWatcherFactory)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException(nameof(synchronizerFactory));
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException(nameof(ensureSynchronizationContext));
            }
            if (folderChangeWatcherFactory == null)
            {
                throw new ArgumentNullException(nameof(folderChangeWatcherFactory));
            }
            if (reportSink == null)
            {
                throw new ArgumentNullException(nameof(reportSink));
            }

            _reportSink                    = reportSink;
            _synchronizerFactory           = synchronizerFactory;
            _ensureSynchronizationContext  = ensureSynchronizationContext;
            _folderChangeWatcherFactory    = folderChangeWatcherFactory;
            _synchronizationTimer.Tick    += SynchronizationTimer_Tick;
            _synchronizationTimer.Interval = (int)_timerInterval.TotalMilliseconds;
            _synchronizationTimer.Start();
        }
    public Scheduler (
      ISynchronizerFactory synchronizerFactory,
      ISynchronizationReportSink reportSink,
      Action ensureSynchronizationContext, 
      IFolderChangeWatcherFactory folderChangeWatcherFactory,
      ISynchronizationRunLogger runLogger)
    {
      if (synchronizerFactory == null)
        throw new ArgumentNullException (nameof (synchronizerFactory));
      if (ensureSynchronizationContext == null)
        throw new ArgumentNullException (nameof (ensureSynchronizationContext));
      if (folderChangeWatcherFactory == null)
        throw new ArgumentNullException (nameof (folderChangeWatcherFactory));
      if (runLogger == null)
        throw new ArgumentNullException (nameof (runLogger));
      if (reportSink == null)
        throw new ArgumentNullException (nameof (reportSink));

      _reportSink = reportSink;
      _synchronizerFactory = synchronizerFactory;
      _ensureSynchronizationContext = ensureSynchronizationContext;
      _folderChangeWatcherFactory = folderChangeWatcherFactory;
      _runLogger = runLogger;
      _synchronizationTimer.Tick += SynchronizationTimer_Tick;
      _synchronizationTimer.Interval = (int) _timerInterval.TotalMilliseconds;
    }
 public SynchronizationProfileRunner(
     ISynchronizerFactory synchronizerFactory,
     ISynchronizationReportRepository synchronizationReportRepository)
 {
     _synchronizerFactory             = synchronizerFactory;
     _synchronizationReportRepository = synchronizationReportRepository;
     // Set to min, to ensure that it runs on the first run after startup
     _lastRun = DateTime.MinValue;
 }
 public SynchronizationProfileRunner (
     ISynchronizerFactory synchronizerFactory,
     ISynchronizationReportRepository synchronizationReportRepository)
 {
   _synchronizerFactory = synchronizerFactory;
   _synchronizationReportRepository = synchronizationReportRepository;
   // Set to min, to ensure that it runs on the first run after startup
   _lastRun = DateTime.MinValue;
 }
    public void SetUp ()
    {
      _synchronizerFactory = MockRepository.GenerateStub<ISynchronizerFactory>();
      _synchronizationProfileRunner = new SynchronizationProfileRunner (_synchronizerFactory);

      var options = new Options();
      _stubSynchronizer = new StubSynchronizer();
      _synchronizerFactory.Expect (f => f.CreateSynchronizer (options)).Return (_stubSynchronizer);
      _synchronizationProfileRunner.UpdateOptions (options);
    }
    public Scheduler (ISynchronizerFactory synchronizerFactory, Action ensureSynchronizationContext)
    {
      if (synchronizerFactory == null)
        throw new ArgumentNullException ("synchronizerFactory");
      if (ensureSynchronizationContext == null)
        throw new ArgumentNullException ("ensureSynchronizationContext");

      _synchronizerFactory = synchronizerFactory;
      _ensureSynchronizationContext = ensureSynchronizationContext;
      _synchronizationTimer.Tick += _synchronizationTimer_Tick;
      _synchronizationTimer.Interval = (int) _timerInterval.TotalMilliseconds;
      _synchronizationTimer.Start();
    }
예제 #13
0
        public void SetUp()
        {
            _synchronizerFactory          = MockRepository.GenerateStub <ISynchronizerFactory>();
            _synchronizationProfileRunner = new SynchronizationProfileRunner(
                _synchronizerFactory,
                MockRepository.GenerateStub <ISynchronizationReportRepository>());

            var options = new Options();

            _stubSynchronizer = new StubSynchronizer();
            _synchronizerFactory.Expect(f => f.CreateSynchronizer(options)).Return(_stubSynchronizer);
            _synchronizationProfileRunner.UpdateOptions(options, false);
        }
        public async Task SetUp()
        {
            _synchronizerFactory          = MockRepository.GenerateStub <ISynchronizerFactory>();
            _synchronizationProfileRunner = new SynchronizationProfileRunner(
                _synchronizerFactory,
                MockRepository.GenerateStub <ISynchronizationReportSink>(),
                MockRepository.GenerateStub <IFolderChangeWatcherFactory> (),
                delegate { },
                MockRepository.GenerateStub <ISynchronizationRunLogger> ());

            var options        = new Options();
            var generalOptions = new GeneralOptions();

            _stubSynchronizer = new StubSynchronizer();
            _synchronizerFactory.Expect(f => f.CreateSynchronizer(options, generalOptions)).Return(Task.FromResult <IOutlookSynchronizer>(_stubSynchronizer));
            await _synchronizationProfileRunner.UpdateOptions(options, generalOptions);
        }
        public SynchronizationProfileRunner(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportSink reportSink,
            IFolderChangeWatcherFactory folderChangeWatcherFactory,
            Action ensureSynchronizationContext,
            ISynchronizationRunLogger runLogger,
            IDateTimeProvider dateTimeProvider,
            Guid profileId)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException(nameof(synchronizerFactory));
            }
            if (reportSink == null)
            {
                throw new ArgumentNullException(nameof(reportSink));
            }
            if (folderChangeWatcherFactory == null)
            {
                throw new ArgumentNullException(nameof(folderChangeWatcherFactory));
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException(nameof(ensureSynchronizationContext));
            }
            if (runLogger == null)
            {
                throw new ArgumentNullException(nameof(runLogger));
            }
            if (dateTimeProvider == null)
            {
                throw new ArgumentNullException(nameof(dateTimeProvider));
            }

            _profileId                    = profileId;
            _synchronizerFactory          = synchronizerFactory;
            _reportSink                   = reportSink;
            _folderChangeWatcherFactory   = folderChangeWatcherFactory;
            _ensureSynchronizationContext = ensureSynchronizationContext;
            _runLogger                    = runLogger;
            _dateTimeProvider             = dateTimeProvider;
            // Set to min, to ensure that it runs on the first run after startup
            _lastRun = DateTime.MinValue;
            _errorHandlingStrategy = new ErrorHandlingStrategy(_profile, _dateTimeProvider, 0);
        }
 public SynchronizationWorker (ISynchronizerFactory synchronizerFactory)
 {
   _synchronizerFactory = synchronizerFactory;
   // Set to min, to ensure that it runs on the first run after startup
   _lastRun = DateTime.MinValue;
 }
예제 #17
0
 public SynchronizationJobFactory(ISynchronizerFactory factory)
 {
     _factory = factory ?? throw new System.ArgumentNullException(nameof(factory));
 }
예제 #18
0
 public SynchronizationWorker(ISynchronizerFactory synchronizerFactory)
 {
     _synchronizerFactory = synchronizerFactory;
     // Set to min, to ensure that it runs on the first run after startup
     _lastRun = DateTime.MinValue;
 }