public void Test_WebWeatherBit_GetJsonAnswer_valid() { WebWeatherBit oWeather = new WebWeatherBit(); PositionCity oPosition = oWeather.GetPositionCity("Navojoa"); string answer = oWeather.GetTempDaysFromWeather(15, "M", oPosition); JObject oJson = JObject.Parse(answer); var oValue = oJson.GetValue("city_name"); Assert.AreEqual("Navojoa", oValue.ToString()); }
public void Test_WebWeatherBit_GetJsonAnswer_unitTemperature() { WebWeatherBit oWeather = new WebWeatherBit(); PositionCity oPosition = oWeather.GetPositionCity("Navojoa"); string answer = oWeather.GetTempDaysFromWeather(1, "I", oPosition); JObject oJson = JObject.Parse(answer); JToken oValue = oJson.GetValue("data"); string respuesta = ""; foreach (var iValue in oValue.Children()) { JObject iJson = JObject.Parse(iValue.ToString()); respuesta = iJson.GetValue("temp").ToString(); } Assert.AreNotEqual("0", respuesta); }