public async Task <CurrentWeatherResponse> GetCurrentWeatherByZipcode(string zipcode, string country, string unit) { var parameter = new OpenWeatherMapClientParam(_config); parameter.AddFilterByZipParams(zipcode, country, unit); return(await GetApiResponse <CurrentWeatherResponse>(parameter, _config.CurrentWeatherRoute)); }
public void Add_Zip_Param_When_Non_Empty() { // Arrange _openWeatherMapClientParam.AddFilterByZipParams(_fakeZip, _fakeCountry, _fakeUnit); var expectedResult = $"zip={_fakeZip},{_fakeCountry}&units={_fakeUnit}"; // Act var actualResult = _openWeatherMapClientParam.ToQueryString(); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void Add_Config_Param_Config_Non_Empty() { // Arrange _openWeatherMapClientParam = new OpenWeatherMapClientParam(new OpenWeatherMapConfig() { DefaultCountryCode = "DE", ApiKey = "AppId" }); _openWeatherMapClientParam.AddFilterByZipParams(_fakeZip, "", _fakeUnit); var expectedResult = $"zip={_fakeZip},DE&units={_fakeUnit}&appid=AppId"; // Act var actualResult = _openWeatherMapClientParam.ToQueryString(); // Assert Assert.AreEqual(expectedResult, actualResult); }