Exemplo n.º 1
0
        public void Should_reset_consumer_when_resetting()
        {
            sut.ActivateAsync(consumerName, store).Wait();
            sut.Activate(eventConsumer);
            sut.Stop();
            sut.Reset();
            sut.Dispose();

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

            A.CallTo(() => persistence.WriteSnapshotAsync(A <EventConsumerState> .Ignored))
            .MustHaveHappened(Repeated.Exactly.Twice);

            A.CallTo(() => eventConsumer.ClearAsync())
            .MustHaveHappened(Repeated.Exactly.Once);

            A.CallTo(() => eventSubscription.StopAsync())
            .MustHaveHappened(Repeated.Exactly.Once);

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

            A.CallTo(() => eventStore.CreateSubscription(A <IEventSubscriber> .Ignored, A <string> .Ignored, null))
            .MustHaveHappened(Repeated.Exactly.Once);
        }
Exemplo n.º 2
0
        public void Should_reset_correct_actor()
        {
            sut.Run();

            pubSub.Publish(new ResetConsumerMessage {
                ConsumerName = consumerName2
            }, true);

            A.CallTo(() => actor1.Reset())
            .MustNotHaveHappened();

            A.CallTo(() => actor2.Reset())
            .MustHaveHappened();
        }