Ejemplo n.º 1
0
        public void Should_not_subscribe_to_event_store_when_stopped_in_db()
        {
            state = state.Stopped();

            sut.ActivateAsync(consumerName, store).Wait();
            sut.Activate(eventConsumer);
            sut.Dispose();

            state.ShouldBeEquivalentTo(new EventConsumerState {
                IsStopped = true, Position = initialPosition, Error = null
            });

            A.CallTo(() => eventStore.CreateSubscription(A <IEventSubscriber> .Ignored, A <string> .Ignored, A <string> .Ignored))
            .MustNotHaveHappened();
        }
Ejemplo n.º 2
0
        public async Task Should_subscribe_to_event_store_when_not_found_in_db()
        {
            await sut.OnActivateAsync(consumerName);

            await sut.ActivateAsync();

            state.ShouldBeEquivalentTo(new EventConsumerState {
                IsStopped = false, Position = initialPosition, Error = null
            });

            A.CallTo(() => eventStore.CreateSubscription(A <IEventSubscriber> .Ignored, A <string> .Ignored, A <string> .Ignored))
            .MustHaveHappened(Repeated.Exactly.Once);
        }