Example #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));
        }
Example #2
0
 public NewsController(ILogger <NewsController> logger)
 {
     _logger     = logger;
     _newsClient = RestService.For <INewsClient>("http://newsapi.org/v2/");
 }
Example #3
0
 public void TestInitialize()
 {
     scope   = container.BeginLifetimeScope();
     client  = scope.Resolve <INewsClient>();
     request = scope.Resolve <INewsRequest>();
 }
Example #4
0
 public NewsService(INewsClient newsClient)
 {
     _newsClient = newsClient;
 }
Example #5
0
        public ClientTests()
        {
            string apiKey = Environment.GetEnvironmentVariable("NEWS_API_KEY");

            _newsClient = new NewsClient(apiKey);
        }