Exemple #1
0
        public async Task CreateSpoolerWithTasks_GivesTasks()
        {
            Spooler <int, int, Tuple <int, string> > spooler = await Spooler <int, int, Tuple <int, string> > .StartNewAsync(_stateManager, _requests.ToArray(), Double, ResultConvertor, 5);

            var tasks = spooler.GetTasks();

            Assert.Equal(11, tasks.Count);
        }
Exemple #2
0
        public async Task CreateSpoolerWithTasks_GivesValidBookMark()
        {
            Spooler <int, int, Tuple <int, string> > spooler = await Spooler <int, int, Tuple <int, string> > .StartNewAsync(_stateManager, _requests.ToArray(), Double, ResultConvertor);

            var bookmark = spooler.GetBookmark();

            Assert.NotNull(bookmark);
            Assert.Equal(11, bookmark.TotalCount);
        }
Exemple #3
0
        public async Task CreateSpoolerFromBookmark_GivesResults()
        {
            Spooler <int, int, Tuple <int, string> > spooler = await Spooler <int, int, Tuple <int, string> > .StartNewAsync(_stateManager, _requests.ToArray(), Double, ResultConvertor);

            var bookmark = spooler.GetBookmark();

            var newSpooler = bookmark.CreateSpooler <int, int, Tuple <int, string> >(_stateManager, 2);

            var results = new List <string>();
            SpoolerResults <Tuple <int, string> > result;

            do
            {
                result = await newSpooler.GetResultsAsync(bookmark);

                bookmark = result.Bookmark;
                results.AddRange(result.Results.Select(x => x.Item2));
            } while (result.MoreResultsAvailable);

            Assert.Equal(11, results.Count);
        }