public void should_call_fetch_on_all_indexers_at_the_same_time()
        {
            var counter = new ConcurrencyCounter(_indexers.Count);

            Mocker.GetMock <IFetchFeedFromIndexers>().Setup(c => c.FetchRss(It.IsAny <IIndexer>()))
            .Returns(new List <ReportInfo>())
            .Callback((() => counter.SimulateWork(500)));

            Mocker.GetMock <IIndexerService>().Setup(c => c.GetAvailableIndexers()).Returns(_indexers);

            Subject.Fetch();

            counter.WaitForAllItems();

            counter.MaxThreads.Should().Be(_indexers.Count);
        }
예제 #2
0
        public void should_call_fetch_on_all_indexers_at_the_same_time()
        {
            var counter = new ConcurrencyCounter(_indexers.Count);

            Mocker.GetMock <IFetchFeedFromIndexers>().Setup(c => c.Fetch(It.IsAny <IIndexer>(), It.IsAny <SingleEpisodeSearchDefinition>()))
            .Returns(new List <ReportInfo>())
            .Callback((() => counter.SimulateWork(500)));

            Mocker.GetMock <IIndexerService>().Setup(c => c.GetAvailableIndexers()).Returns(_indexers);

            Mocker.GetMock <IMakeDownloadDecision>()
            .Setup(c => c.GetSearchDecision(It.IsAny <IEnumerable <ReportInfo> >(), It.IsAny <SearchDefinitionBase>()))
            .Returns(new List <DownloadDecision>());

            Subject.SearchSingle(0, 0, 0);

            counter.WaitForAllItems();

            counter.MaxThreads.Should().Be(_indexers.Count);
        }