public async Task Should_subscribe_on_start()
        {
            var sut = new PollingSubscription(eventStore, eventNotifier, eventSubscriber, "^my-stream", position);

            await WaitAndStopAsync(sut);

            A.CallTo(() => eventStore.GetEventsAsync(A <Func <StoredEvent, Task> > .Ignored, A <CancellationToken> .Ignored, "^my-stream", position))
            .MustHaveHappened(Repeated.Exactly.Once);
        }
        public async Task Should_propagate_aggregate_operation_cancelled_exception_to_subscriber()
        {
            var ex = new AggregateException(new OperationCanceledException());

            A.CallTo(() => eventStore.GetEventsAsync(A <Func <StoredEvent, Task> > .Ignored, A <CancellationToken> .Ignored, "^my-stream", position))
            .Throws(ex);

            var sut = new PollingSubscription(eventStore, eventNotifier, eventSubscriber, "^my-stream", position);

            await WaitAndStopAsync(sut);

            A.CallTo(() => eventSubscriber.OnErrorAsync(sut, ex))
            .MustNotHaveHappened();
        }
        private async Task WaitAndStopAsync(PollingSubscription sut)
        {
            await Task.Delay(200);

            await sut.StopAsync();
        }