public async Task ReadEventsAsync_WhenCursorIsNotEmpty_ReturnsNotEmptyCollectionEvents(
            EventStreamReader reader)
        {
            await reader.ReadEventsAsync();

            Assert.NotEmpty(reader.Events);
        }
        public async Task ReadEventsAsync_EnsureConnectivityStateIsActive(
            [Frozen] Mock <IEventStoreConnectionState> stateMock,
            EventStreamReader reader)
        {
            await reader.ReadEventsAsync();

            stateMock.Verify(self => self.EnsureConnectionIsActive());
        }
        public async Task ReadEventsAsync_UseMutationPipelineForEachReceivedEvent(
            [Frozen] Mock <IEventMutationPipeline> pipelineMock,
            [Frozen] SortedList <StreamVersion, JournaledEvent> receivedEvents,
            EventStreamReader reader)
        {
            await reader.ReadEventsAsync();

            pipelineMock.Verify(
                self => self.Mutate(It.Is <JournaledEvent>(e => receivedEvents.ContainsValue(e))),
                Times.Exactly(receivedEvents.Count));
        }
        public async Task ReadEventsAsync_ReplaceReceivedEventsWithTheyMutatedVersion(
            [Frozen] Mock <IEventMutationPipeline> pipelineMock,
            JournaledEvent[] mutatedEvents,
            EventStreamReader reader)
        {
            var callsCount = 0;

            pipelineMock
            .Setup(self => self.Mutate(It.IsAny <JournaledEvent>()))
            .Returns(() => mutatedEvents[callsCount++]);

            await reader.ReadEventsAsync();

            Assert.Equal(mutatedEvents.Select(e => e.EventId), reader.Events.Select(e => e.EventId));
        }
 public async Task ReadEventsAsync_WhenCursorIsNotEmpty_DoesNotThrow(
     EventStreamReader reader)
 {
     await reader.ReadEventsAsync();
 }