public void TestWeatherEntryParse() { var demoData = Automatica.Core.Driver.Utility.Utils.StringToByteArray("40F95912010000002801000003000000370000000000000000002A40CDCCCCCCCCCC2540E8034EEFA9DA10400000000000000000CDCCCCCCCCCC0C4000000000000C9040"); var weather = WeatherEntry.Parse(demoData); Assert.NotNull(weather); Assert.Equal(1027, weather.BarometicPressure); Assert.Equal(4.2, Math.Round(weather.DewPoint, 1)); Assert.Equal(10.9, weather.PerceivedTemperature); Assert.Equal(0, weather.Precipitation); Assert.Equal(55, weather.RelativeHumidity); Assert.Equal(3, weather.SolarRadiation); Assert.Equal(13, weather.Temperature); Assert.Equal(307886400, weather.Timestamp); Assert.Equal(1, weather.WeatherType); Assert.Equal(296, weather.WindDirection); Assert.Equal(3.6, weather.WindSpeed); }
public void TestWeatherEntryParseFail2() { var demoData = Automatica.Core.Driver.Utility.Utils.StringToByteArray("010000002801000003000000370000000000000000002A40CDCCCCCCCCCC2540E8034EEFA9DA10400000000000000000CDCCCCCCCCCC0C4000000000000C9040"); Assert.Throws <ArgumentException>(() => WeatherEntry.Parse(demoData)); }