public void TomorrowIoGoodJsonParseTest() { var json = new JObject(new JProperty("data", new JObject(new JProperty("timelines", new JArray(new JObject(new JProperty("timestep", "current"), new JProperty("endTime", "2022-04-20T16:51:00Z"), new JProperty("startTime", "2022-04-20T16:51:00Z"), new JProperty("intervals", new JArray(new JObject(new JProperty("startTime", "2022-04-20T16:51:00Z"), new JProperty("values", new JObject(new JProperty("cloudCover", 0), new JProperty("humidity", 0), new JProperty("precipitationType", 0), new JProperty("temperature", 0), new JProperty("windDirection", 360), new JProperty("windSpeed", 0)))))))))))).ToString(); var weather = TomorrowIoJsonParser.Parse(json); Assert.AreEqual(0, weather.TempInCelcius); Assert.AreEqual(32, weather.TempInFahrenheit); Assert.AreEqual(0, weather.Humidity); Assert.AreEqual(0, weather.Cloudiness); Assert.AreEqual("North", weather.WindDir); Assert.AreEqual(0, weather.WindSpeed); Assert.AreEqual("Clear", weather.Precipitation); }
public void TomorrowIoBadJsonParseTest() { string?json = null; var weather = TomorrowIoJsonParser.Parse(json); Assert.AreEqual(null, weather); }