示例#1
0
        public void Should_reset_consumer_when_resetting()
        {
            sut.Activate(eventConsumer);
            sut.Stop();
            sut.Reset();
            sut.Dispose();

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

            A.CallTo(() => stateHolder.WriteAsync())
            .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);
        }
示例#2
0
        public void Should_reset_correct_actor()
        {
            sut.Connect();

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

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

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