Пример #1
0
        public async Task StreamPosition_AfterWriteAsyncCall_UpdatedStreamVersionValue(
            [Frozen] Mock<IEventJournal> journalMock,
            EventStreamHeader header,
            EventStreamWriter writer,
            JournaledEvent[] events)
        {
            journalMock
                .Setup(self => self.AppendEventsAsync(
                    It.IsAny<string>(),
                    It.IsAny<EventStreamHeader>(),
                    It.IsAny<IReadOnlyCollection<JournaledEvent>>()))
                .Returns(header.YieldTask());

            await writer.AppendEventsAsync(events);

            Assert.Equal(header.Version, writer.StreamVersion);
        }
Пример #2
0
        public async Task AppendEvents_DeletesPendingNotification(
            [Frozen] Mock<IEventJournal> journalMock,
            [Frozen] Mock<IPendingNotifications> pendingNotificationMock,
            [Frozen] EventStreamHeader header,
            EventStreamWriter writer,
            JournaledEvent[] events)
        {
            journalMock
                .Setup(self => self.AppendEventsAsync(
                    It.IsAny<string>(),
                    It.IsAny<EventStreamHeader>(),
                    It.IsAny<IReadOnlyCollection<JournaledEvent>>()))
                .Returns(header.YieldTask());

            await writer.AppendEventsAsync(events);

            pendingNotificationMock.Verify(notifications => notifications.DeleteAsync(
                writer.StreamName,
                header.Version));
        }