private ObservableHandler RunQueue(Mock <ISession> session, Mock <IMetaDataStorage> storage)
        {
            var manager = new SyncEventManager();

            var observer = new ObservableHandler();

            manager.AddEventHandler(observer);

            SingleStepEventQueue queue = new SingleStepEventQueue(manager);

            var changes = new ContentChanges(session.Object, storage.Object, queue, this.maxNumberOfContentChanges, this.isPropertyChangesSupported);

            manager.AddEventHandler(changes);

            var transformer = new ContentChangeEventTransformer(queue, storage.Object);

            manager.AddEventHandler(transformer);

            var accumulator = new ContentChangeEventAccumulator(session.Object, queue);

            manager.AddEventHandler(accumulator);

            queue.RunStartSyncEvent();

            return(observer);
        }
        public void QueueRethrowsExceptionsByDefault()
        {
            var manager = new Mock <ISyncEventManager>();

            manager.Setup(m => m.Handle(It.IsAny <ISyncEvent>())).Throws <Exception>();
            var queue = new SingleStepEventQueue(manager.Object);

            Assert.Throws <Exception>(() => queue.RunStartSyncEvent());
        }
        public void QueueSwallowsExceptionsIfConfigured()
        {
            var manager = new Mock <ISyncEventManager>();

            manager.Setup(m => m.Handle(It.IsAny <ISyncEvent>())).Throws(new Exception());
            var queue = new SingleStepEventQueue(manager.Object);

            queue.SwallowExceptions = true;
            queue.RunStartSyncEvent();
        }
        private ObservableHandler RunQueue(Mock<ISession> session, Mock<IMetaDataStorage> storage) {
            var manager = new SyncEventManager();

            var observer = new ObservableHandler();
            manager.AddEventHandler(observer);

            SingleStepEventQueue queue = new SingleStepEventQueue(manager);

            var changes = new ContentChanges(session.Object, storage.Object, queue, this.maxNumberOfContentChanges, this.isPropertyChangesSupported);
            manager.AddEventHandler(changes);

            var transformer = new ContentChangeEventTransformer(queue, storage.Object);
            manager.AddEventHandler(transformer);

            var accumulator = new ContentChangeEventAccumulator(session.Object, queue);
            manager.AddEventHandler(accumulator);

            queue.RunStartSyncEvent();

            return observer;
        }
 public void QueueSwallowsExceptionsIfConfigured() {
     var manager = new Mock<ISyncEventManager>();
     manager.Setup(m => m.Handle(It.IsAny<ISyncEvent>())).Throws(new Exception());
     var queue = new SingleStepEventQueue(manager.Object);
     queue.SwallowExceptions = true;
     queue.RunStartSyncEvent();
 }
 public void QueueRethrowsExceptionsByDefault() {
     var manager = new Mock<ISyncEventManager>();
     manager.Setup(m => m.Handle(It.IsAny<ISyncEvent>())).Throws<Exception>();
     var queue = new SingleStepEventQueue(manager.Object);
     Assert.Throws<Exception>(() => queue.RunStartSyncEvent());
 }