Exemplo n.º 1
0
        public async Task Media_feed_projection_is_initialized_from_bootstrap()
        {
            var mediaId = Guid.NewGuid();

            _eventStore
            .GetAllEventsBetween(Arg.Any <Position>(), Arg.Any <Position>(), Arg.Any <IReadOnlyCollection <Type> >())
            .Returns(new AsyncList <IEvent> {
                new MediaFeedAdded(mediaId, "https://site/rss.xml"),
                new MediaFeedAdded(mediaId, "https://site/atom.xml"),
                new MediaFeedAdded(mediaId, "https://site/rss1.xml"),
                new MediaFeedRemoved(mediaId, "https://site/rss1.xml"),
            });

            await _projectionsBootstrapper.InitializeUntil(0);

            (await _finder.GetAllMediaFeeds())
            .Should()
            .BeEquivalentTo(new[] {
                new MediaFeedReadModel {
                    MediaId = mediaId,
                    FeedUrl = "https://site/rss.xml"
                },
                new MediaFeedReadModel {
                    MediaId = mediaId,
                    FeedUrl = "https://site/atom.xml"
                }
            });
        }
Exemplo n.º 2
0
        // ----- Public methods

        public async Task StartAggregation(CancellationToken token)
        {
            var lastStreamEventPosition = await GetLastStreamEventPosition();

            await _projectionsBootstrapper.InitializeUntil(lastStreamEventPosition.Value);

            await _eventBus.SubscribeToEvents(lastStreamEventPosition, GetEventTypes(), DomainEventReceived, () => {
                StartFeedSynchronization(token);
            });
        }