public void GetWeatherByCity() { string city = "London"; ByCityCountryRequest request = new ByCityCountryRequest(city); CommonResponse expectedResponse = new CommonResponse(city, 200); SendRequestCheckResponseWithValidation(request, expectedResponse); }
public void GetWeatherViaInvalidUrl() { ByCityCountryRequest request = new ByCityCountryRequest("London"); CommonResponse expectedResponse = new CommonResponse(null, 401).SetMessage("Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."); Response response = WeatherEndpoint.SendGetRequest(request, "https://api.openweathermap.org/data/2.5weatherAPPID=9acb0f4df01ac2645b18fabf8ac4bdc6").Execute().GetResponse(0); CommonResponse actualResponse = JsonConvert.DeserializeObject <CommonResponse>(response.ResponseBody); Comparator.CompareObjects(actualResponse, expectedResponse); }
public void GetWeatherViaNonExistingEndpoint() { ByCityCountryRequest request = new ByCityCountryRequest("London"); CommonResponse expectedResponse = new CommonResponse(null, 404).SetMessage("Internal error"); Response response = NonExistingEndpoint.SendGetRequest(request).Execute().GetResponse(0); CommonResponse actualResponse = JsonConvert.DeserializeObject <CommonResponse>(response.ResponseBody); Comparator.CompareObjects(actualResponse, expectedResponse); }
public void GetWeatherByCityAndCountry() { string city = "Kyiv"; string country = "UA"; ByCityCountryRequest request = new ByCityCountryRequest(city, country); CommonResponse expectedResponse = new CommonResponse(city, 200, country); SendRequestCheckResponseWithValidation(request, expectedResponse); }