Exemple #1
0
        public ArticleFetchBackgroundService(INewsClient newsClient, IServiceProvider serviceProvider, ILogger <ArticleFetchBackgroundService> logger, IConfiguration configuration)
        {
            _client   = newsClient;
            _provider = serviceProvider;
            _logger   = logger;

            SleepingPeriod = TimeSpan.FromMinutes(double.Parse(configuration.GetSection("ArticleFetchService:SleepingPeriodMinutes").Value));
        }
Exemple #2
0
 public NewsController(ILogger <NewsController> logger)
 {
     _logger     = logger;
     _newsClient = RestService.For <INewsClient>("http://newsapi.org/v2/");
 }
 public void TestInitialize()
 {
     scope   = container.BeginLifetimeScope();
     client  = scope.Resolve <INewsClient>();
     request = scope.Resolve <INewsRequest>();
 }
Exemple #4
0
 public NewsService(INewsClient newsClient)
 {
     _newsClient = newsClient;
 }
Exemple #5
0
        public ClientTests()
        {
            string apiKey = Environment.GetEnvironmentVariable("NEWS_API_KEY");

            _newsClient = new NewsClient(apiKey);
        }