protected override void DoSetUp()
        {
            var servicePath = TestAzureHelper.GetPath("test");

            _commandProcessor = CommandProcessor.With()
                                .Logging(l => l.UseConsole(minLevel: Logger.Level.Debug))
                                .EventStore(e => e.Register <IEventStore>(c => new InMemoryEventStore()))
                                .EventDispatcher(e => e.UseAzureServiceBusRelayEventDispatcher("cirqus", servicePath, TestAzureHelper.KeyName, TestAzureHelper.SharedAccessKey))
                                .Create();

            RegisterForDisposal(_commandProcessor);

            _eventStoreProxy = new AzureServiceBusRelayEventStoreProxy("cirqus", servicePath, TestAzureHelper.KeyName, TestAzureHelper.SharedAccessKey);

            RegisterForDisposal(_eventStoreProxy);

            _viewManager = new InMemoryViewManager <View>();

            var serializer = new JsonDomainEventSerializer();
            var typeMapper = new DefaultDomainTypeNameMapper();

            var eventDispatcher = new ViewManagerEventDispatcher(new DefaultAggregateRootRepository(_eventStoreProxy, serializer, typeMapper), _eventStoreProxy, serializer, typeMapper);

            RegisterForDisposal(eventDispatcher);

            eventDispatcher.AddViewManager(_viewManager);
            eventDispatcher.Initialize();
        }
Пример #2
0
        public void Initialize()
        {
            if (!_initialized)
            {
                if (_viewManagerEventDispatcher != null)
                {
                    _viewManagerEventDispatcher.Initialize(_eventStore, purgeExistingViews: true);
                }

                _initialized = true;
            }
        }