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);
    }
Beispiel #2
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 async Task RunNoThrowAndRescheduleIfNotRunning()
        {
            var synchronizer = new StubSynchronizer();

            await SetupSynchronizerFactory(synchronizer);

            var synchronizationTask1 = _synchronizationProfileRunner.RunAndRescheduleNoThrow(true);
            var synchronizationTask2 = _synchronizationProfileRunner.RunAndRescheduleNoThrow(true);
            var synchronizationTask3 = _synchronizationProfileRunner.RunAndRescheduleNoThrow(true);
            var synchronizationTask4 = _synchronizationProfileRunner.RunAndRescheduleNoThrow(true);

            Assert.That(synchronizationTask1.IsCompleted, Is.False);
            Assert.That(synchronizationTask2.IsCompleted, Is.True);
            Assert.That(synchronizationTask3.IsCompleted, Is.True);
            Assert.That(synchronizationTask4.IsCompleted, Is.True);

            synchronizer.FinishSynchronizationEvent.Set();

            synchronizationTask1.Wait();

            Assert.That(synchronizer.RunCount, Is.EqualTo(2));
        }