コード例 #1
0
        private Scraper BuildSut(IScraperHttpClient scraperHttpClient = null,
                                 IScrapeRepository scrapeRepository   = null,
                                 IOptions <ScraperOptions> options    = null,
                                 ILogger <Scraper> logger             = null)
        {
            if (scraperHttpClient == null)
            {
                scraperHttpClient = FakeHttpClient;
            }

            if (scrapeRepository == null)
            {
                scrapeRepository = FakeRepository;
            }

            if (options == null)
            {
                options = FakeOptions;
                var scraperOptions = new ScraperOptions()
                {
                    MazeApiMaxPageSize = 250
                };
                A.CallTo(() => options.Value).Returns(scraperOptions);
            }

            if (logger == null)
            {
                logger = FakeLogger;
            }

            return(new Scraper(scraperHttpClient, scrapeRepository, options, logger));
        }
コード例 #2
0
 public Scraper(IScraperHttpClient scraperHttpClient, IScrapeRepository scrapeRepository,
                IOptions <ScraperOptions> options, ILogger <Scraper> logger)
 {
     _scraperHttpClient = scraperHttpClient;
     _options           = options.Value;
     _logger            = logger;
     _scrapeRepository  = scrapeRepository;
 }
コード例 #3
0
 public GetScrapeDetailQuery(IScrapeRepository repository)
 {
     if (repository == null)
     {
         throw new ArgumentNullException(nameof(repository));
     }
     _repository = repository;
 }
コード例 #4
0
        public TriggerScrapeCommand(IScrapeRepository repository, IScraper scraper)
        {
            if (scraper == null)
            {
                throw new ArgumentNullException(nameof(scraper));
            }

            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            _scraper = scraper;
        }
コード例 #5
0
 public TvMazeScrapeService(
     IHttpClientFactory httpClientFactory,
     IScrapeRepository scrapeRepository,
     ILogger <TvMazeScrapeService> logger,
     IMapper mapper,
     IShowRepository showRepository,
     IPersonRepository personRepository,
     ICastMemberRepository castMemberRepository)
 {
     this.httpClientFactory    = httpClientFactory;
     this.scrapeRepository     = scrapeRepository;
     this.logger               = logger;
     this.mapper               = mapper;
     this.showRepository       = showRepository;
     this.personRepository     = personRepository;
     this.castMemberRepository = castMemberRepository;
 }
コード例 #6
0
 public ScrapeService(IScrapeRepository scrapeRepository, IStorageRepository storageRepository)
 {
     this.scrapeRepository  = scrapeRepository;
     this.storageRepository = storageRepository;
 }