示例#1
0
        private void before_each()
        {
            _node       = EmbeddedEventStore.Start();
            _connection = EmbeddedEventStoreConnection.Create(_node);
            _connection.ConnectAsync().Wait();

            _sut = new UserByEmailIndex(_connection, new EventSerializer());
        }
示例#2
0
        private void before_each()
        {
            _node       = EmbeddedEventStore.Start();
            _connection = EmbeddedEventStoreConnection.Create(_node);
            _connection.ConnectAsync().Wait();

            _sut = new UserRegistrationProcessRepository(_connection, new EventSerializer());
        }
        public static IEventStoreConnection Create(EventStoreLocation eventStoreLocation, IEventStoreConfiguration configuration)
        {
            IEventStore eventStore;

            if (eventStoreLocation == EventStoreLocation.Embedded)
            {
                eventStore = new EmbeddedEventStore();
            }
            else
            {
                eventStore = new ExternalEventStore(EventStoreUri.FromConfig(configuration));
            }

            return(eventStore.Connection);
        }
        private void before_each()
        {
            var embeddedNode       = EmbeddedEventStore.Start();
            var embeddedConnection = EmbeddedEventStoreConnection.Create(embeddedNode);

            embeddedConnection.ConnectAsync().Wait();

            var eventSerializerStub = new EventSerializerStub();

            var eventHandlerMock = new EventHandlerMock();
            var sut = new EventStoreSubscriptionStarter(new EventSerializerStub(), eventHandlerMock);

            _node         = embeddedNode;
            _connection   = embeddedConnection;
            _serializer   = eventSerializerStub;
            _eventHandler = eventHandlerMock;
            _sut          = sut;
        }
        private void before_each()
        {
            var node = EmbeddedEventStore.Start();

            var connectionSettings = ConnectionSettings
                                     .Create()
                                     .SetDefaultUserCredentials(new UserCredentials("admin", "changeit"));

            var connection = EmbeddedEventStoreConnection.Create(node, connectionSettings);

            connection.ConnectAsync().Wait();

            var eventSerializer = new EventSerializer();
            var userRegistrationProcessRepository = new UserRegistrationProcessRepository(connection, eventSerializer);
            var userByEmailInMemoryIndex          = new UserByEmailIndex(connection, eventSerializer);

            var commandService = new UserRegistrationCommandService(userRegistrationProcessRepository);
            var queryService   = new UserRegistrationQueryService(userRegistrationProcessRepository);

            var userRepository = new UserRepository(connection, eventSerializer);

            var userRegistrationEventHandler = new UserRegistrationEventHandler(
                userRegistrationProcessRepository,
                userRepository,
                userByEmailInMemoryIndex);

            var userRegistrationEventHandlerAdapter = new UserRegistrationEventHandlerAdapter(userRegistrationEventHandler);
            var subscriptionStarter = new EventStoreSubscriptionStarter(eventSerializer, userRegistrationEventHandlerAdapter);
            var subscription        = subscriptionStarter.Start(connection);

            _node           = node;
            _connection     = connection;
            _commandService = commandService;
            _queryService   = queryService;
            _subscription   = subscription;
        }