public SqlEventStoreTests()
        {
            EventCollection.AddAssemblyTypes(Assembly.GetExecutingAssembly(), Assembly.GetCallingAssembly());
            var streamStoreFactoryMock = new Mock <IStreamStoreFactory>();

            streamStoreFactoryMock
            .Setup(streamStoreFactory => streamStoreFactory.GetStreamStore(3, CancellationToken.None))
            .ReturnsAsync(_streamStore);

            _sut = new SqlEventStore(streamStoreFactoryMock.Object, Activator.CreateInstance);
        }
        public void ShouldIgnoreDuplicates()
        {
            // Arrange
            var eventCount = EventCollection.EventTypes.Count();

            eventCount.ShouldBeGreaterThan(0);

            // Act
            EventCollection.AddAssemblyTypes(Assembly.GetExecutingAssembly());

            // Assert
            EventCollection.EventTypes.Count().ShouldBe(eventCount);
        }
Ejemplo n.º 3
0
        protected ReplayManagerTestsFixture()
        {
            EventCollection.AddAssemblyTypes(Assembly.GetExecutingAssembly());
            StreamStoreMock      = new Mock <IStreamStore>();
            EventSourcingOptions = new EventSourcingOptions();

            SetupReadStreamBackwards(StreamId);
            SetupReadStreamForwards(StreamId);

            var streamStoreFactoryMock = new Mock <IStreamStoreFactory>();

            streamStoreFactoryMock
            .Setup(streamStoreFactory => streamStoreFactory.GetStreamStore(3, CancellationToken.None))
            .ReturnsAsync(StreamStoreMock.Object);
            Sut = new ReplayManager(streamStoreFactoryMock.Object, EventSourcingOptions, Mock.Of <ILogger <ReplayManager> >());
        }
Ejemplo n.º 4
0
        public EventSubscriptionTests()
        {
            EventCollection.AddAssemblyTypes(Assembly.GetExecutingAssembly());

            _streamStore = new InMemoryStreamStore();

            IEventObserver observer = new TestObserver(true, false, @event =>
            {
                _observedEvent = @event;
                _waitEvent.Set();
            });

            var streamStoreFactoryMock = new Mock <IStreamStoreFactory>();

            streamStoreFactoryMock
            .Setup(streamStoreFactory => streamStoreFactory.GetStreamStore(3, It.IsAny <CancellationToken>()))
            .ReturnsAsync(_streamStore);

            _sut = new EventSubscription(new[] { observer }, NullLogger <EventSubscription> .Instance,
                                         streamStoreFactoryMock.Object, Mock.Of <SetGlobalCheckpoint>(), Mock.Of <GetGlobalCheckpoint>());
        }
 public static IApplicationBuilder UseEventSourcing(this IApplicationBuilder appBuilder,
                                                    params Type[] pointerTypes)
 {
     EventCollection.AddAssemblyTypes(pointerTypes.Select(type => type.Assembly).ToArray());
     return(appBuilder);
 }
 public static IApplicationBuilder UseEventSourcing(this IApplicationBuilder appBuilder,
                                                    params Assembly[] assemblies)
 {
     EventCollection.AddAssemblyTypes(assemblies);
     return(appBuilder);
 }
 public StreamMessageExtensionsTests()
 {
     EventCollection.AddAssemblyTypes(Assembly.GetExecutingAssembly());
     _streamMessage = BuildMessage();
 }
 public EventCollectionTests()
 {
     EventCollection.AddAssemblyTypes(Assembly.GetExecutingAssembly());
 }
Ejemplo n.º 9
0
 public static IHost UseEventSourcing(this IHost host, params Type[] pointerTypes)
 {
     EventCollection.AddAssemblyTypes(pointerTypes.Select(type => type.Assembly).ToArray());
     return(host);
 }
Ejemplo n.º 10
0
 public static IHost UseEventSourcing(this IHost host, params Assembly[] assemblies)
 {
     EventCollection.AddAssemblyTypes(assemblies);
     return(host);
 }