Ejemplo n.º 1
0
        public WeatherProvider(
            ILogger <WeatherProvider> logger,
            ILocationProvider locationProvider,
            ICacheRepository <WeatherConditions> cacheRepository,
            IForecastService forecastService,
            IOpenWeatherMapService openWeatherMapService,
            IYahooWeatherService yahooWeatherService)
            : base(logger, cacheRepository)
        {
            try
            {
                var location = locationProvider.Execute().Result;
                if (location == null)
                {
                    _logger.LogError($"{GetType().Name}: Cannot get Location. Weather will disabled.");
                }
                else
                {
                    _serializedLocation = JsonConvert.SerializeObject(location);

                    _operations.Add(yahooWeatherService);
                    _operations.Add(openWeatherMapService);
                    _operations.Add(forecastService);
                }
            }
            catch (Exception e)
            {
                _logger.LogError("WeatherProvider", e);
                throw e;
            }
        }
Ejemplo n.º 2
0
 public YahooController(
     ILogger <YahooWeatherService> logger,
     IYahooWeatherService service,
     ICookiesService <OauthToken> cookiesService,
     IAccessTokensRepository accessTokensRepository) : base(logger, service, cookiesService, accessTokensRepository)
 {
     _cookieKey = "YahooRequestToken";
 }
Ejemplo n.º 3
0
        public YahooWeatherManagerFacts()
        {
            _module = new TestModule();
            var kernel = new StandardKernel(_module);

            _weatherService = kernel.Get <IYahooWeatherService>();

            _module.YahooHttpManagerMock.Setup(ctx => ctx.Get(It.IsAny <string>())).Returns(new WeatherResponse());
        }
Ejemplo n.º 4
0
 public TelegramService(ILog logger,
                        IUpdateManager updateManager,
                        IMessageService messageService,
                        IYahooWeatherService weatherService,
                        IUnitsConverterFactory unitsConverterFactory)
 {
     _updateManager         = updateManager;
     _messageService        = messageService;
     _weatherService        = weatherService;
     _unitsConverterFactory = unitsConverterFactory;
     _logger = logger;
     _logger.Debug($"Telegram Manager creation...");
     _updates = new Queue <Update>();
 }