Exemple #1
0
 public OpenWeatherMapClientTest()
 {
     _mockHttpMessageHandler = new Mock <HttpMessageHandler>();
     _mockConfig             = new OpenWeatherMapConfig()
     {
         ApiBaseUrl = "fakebaseurl"
     };
 }
        public ForecastServiceTest()
        {
            _openWeatherMapConfig = new OpenWeatherMapConfig {
                IconUrl = "fakeurl/{0}.png"
            };
            _mockMapper                = new Mock <IMapper>();
            _mockGetForecastFunc       = new Mock <Func <string, string, string, Task <WeatherForecastResponse> > >();
            _mockGetCurrentWeatherFunc = new Mock <Func <string, string, string, Task <CurrentWeatherResponse> > >();
            _mapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new WeatherForecastMappingProfile());
            }).CreateMapper();

            _mockCurrentWeatherResponse = new CurrentWeatherResponse()
            {
                DateUnixFormat = 1590144273,
                WeatherInfo    = new WeatherCondition {
                    Temperature = 69.55, Humidity = 50
                },
                WindData = new Wind {
                    Speed = 9.53
                },
                WeatherData = new WeatherResponse[] { new WeatherResponse {
                                                          Icon = "04d"
                                                      } }
            };

            _mockWeatherForecastResponse = new WeatherForecastResponse()
            {
                CityData = new City {
                    Name = "Hamburg", Country = "DE"
                },
                ForecastData = new ForecastResponse[] {
                    new ForecastResponse {
                        DateUnixFormat = 1590559200,
                        WeatherInfo    = new WeatherCondition {
                            Temperature = 69.55,
                            Humidity    = 50
                        },
                        WindData = new Wind()
                        {
                            Speed = 9.53
                        },
                        WeatherData = new WeatherResponse[] { new WeatherResponse {
                                                                  Icon = "04d"
                                                              } }
                    }
                }
            };
        }
Exemple #3
0
 public OpenWeatherMapService(IOptions <OpenWeatherMapConfig> config) : base(config.Value)
 {
     _config = config.Value;
 }
 public MockWeatherClient(HttpClient client, OpenWeatherMapConfig config)
 {
     _client = client;
     _config = config;
 }
Exemple #5
0
 public OpenWeatherMapClientParamTest()
 {
     _mockConfig = new OpenWeatherMapConfig();
     _openWeatherMapClientParam = new OpenWeatherMapClientParam(_mockConfig);
 }
Exemple #6
0
 public OpenWeatherMapService(OpenWeatherMapConfig config)
 {
     _config = config;
 }
Exemple #7
0
 public ForecastService(OpenWeatherMapConfig config, IMapper mapper)
 {
     _config = config;
     _mapper = mapper;
 }