Exemple #1
0
        public async Task should_not_pause_the_fetcher_if_under_the_threshold()
        {
            var thePage = new EventPage(0, 100, EventMother.Random(100));

            await theProjectionTrack.CachePage(thePage).ConfigureAwait(false);

            await theFetcher.DidNotReceive().Pause().ConfigureAwait(false);
        }
Exemple #2
0
        public async Task stores_the_first_page()
        {
            var thePage = new EventPage(0, 100, EventMother.Random(100));

            await theProjectionTrack.CachePage(thePage).ConfigureAwait(false);

            theProjectionTrack.Accumulator.AllPages().Single()
            .ShouldBe(thePage);
        }
Exemple #3
0
        public async Task should_restart_the_fetcher_if_it_was_paused_and_below_the_threshold()
        {
            theFetcher.State.Returns(FetcherState.Paused);

            var thePage = new EventPage(0, 100, EventMother.Random(100));
            await theProjectionTrack.CachePage(thePage).ConfigureAwait(false);

            await theProjectionTrack.StoreProgress(typeof(ActiveProject), thePage).ConfigureAwait(false);

            theFetcher.Received().Start(theProjectionTrack, theProjectionTrack.Lifecycle);
        }
Exemple #4
0
        public async Task pauses_the_fetcher_if_the_queue_number_is_greater_than_the_options_threshold()
        {
            // The default for MaximumStagedEventCount is 1000
            await theProjectionTrack.CachePage(new EventPage(0, 100, EventMother.Random(100))).ConfigureAwait(false);

            await theProjectionTrack.CachePage(new EventPage(101, 200, EventMother.Random(100))).ConfigureAwait(false);

            await theProjectionTrack.CachePage(new EventPage(201, 1100, EventMother.Random(1001100 - 201))).ConfigureAwait(false);

            await theFetcher.Received().Pause().ConfigureAwait(false);
        }
Exemple #5
0
        public async Task store_progress_removes_obsolete_page()
        {
            var thePage  = new EventPage(0, 100, EventMother.Random(100));
            var thePage2 = new EventPage(101, 200, EventMother.Random(100));
            await theProjectionTrack.CachePage(thePage).ConfigureAwait(false);

            await theProjectionTrack.CachePage(thePage2).ConfigureAwait(false);

            await theProjectionTrack.StoreProgress(typeof(ActiveProject), thePage).ConfigureAwait(false);

            theProjectionTrack.Accumulator.AllPages().Single()
            .ShouldBe(thePage2);
        }
 private EventPage toPage(long from, long to, int eventCount)
 {
     return(new EventPage(from, to, EventMother.Random(eventCount)));
 }
Exemple #7
0
        public async Task should_queue_the_page_on_each_projection_on_the_first_one()
        {
            var thePage = new EventPage(0, 100, EventMother.Random(100));

            await theProjectionTrack.CachePage(thePage).ConfigureAwait(false);
        }