public void InterpretDataCountTest() { string gfscode = "2017012518_060"; RealTimeAtmosphere weatherData = new RealTimeAtmosphere(); PrivateObject obj = new PrivateObject(weatherData); obj.SetFieldOrProperty("_gfscode", gfscode); /* Download the file if it does not exist. This only needs to be done once */ if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\..\..\Data\gfs.t18z.pgrb2.0p50.f060.grb2")) { obj.Invoke("DownloadData"); } obj.SetFieldOrProperty("_filePath", AppDomain.CurrentDomain.BaseDirectory + @"\..\..\Data\gfs.t18z.pgrb2.0p50.f060.grb2"); obj.Invoke("InterpretData"); int expectedCount = 32; //weatherData.temperature(1350); double pressure = ((SortedList <double, double>)obj.GetFieldOrProperty("pressureData")).Count; double temperature = ((SortedList <double, double>)obj.GetFieldOrProperty("temperatureData")).Count; double uVelocity = ((SortedList <double, double>)obj.GetFieldOrProperty("uVelocityData")).Count; double vVelocity = ((SortedList <double, double>)obj.GetFieldOrProperty("vVelocityData")).Count; Assert.AreEqual(expectedCount, pressure); Assert.AreEqual(expectedCount, temperature); Assert.AreEqual(expectedCount, uVelocity); Assert.AreEqual(expectedCount, vVelocity); }
public void UsePreviousDaysRunTest() { // TODO: Figure out how to test a future date. Have tested on the first release RealTimeAtmosphere weatherData = new RealTimeAtmosphere(); PrivateObject obj = new PrivateObject(weatherData); obj.SetFieldOrProperty("_gfscode", "2017012106_001"); obj.Invoke("UsePreviousDaysRun"); Assert.AreEqual("2017012006_025", ((string)obj.GetFieldOrProperty("_gfscode"))); }
public void GFSDatecodeTest() { // TODO: Figure out how to test a future date. Have tested on the first release RealTimeAtmosphere weatherData = new RealTimeAtmosphere(); PrivateObject obj = new PrivateObject(weatherData); obj.SetFieldOrProperty("_date", (new DateTime(2017, 01, 20, 11, 6, 1, DateTimeKind.Utc))); obj.Invoke("ConvertToNearestGFS"); Assert.AreEqual("2017012006_005", ((string)obj.GetFieldOrProperty("_gfscode"))); }
public void DownloadDataTest() { string gfscode = "2017012518_060"; /* Don't kill the network by accidentally running this a bunch */ RealTimeAtmosphere weatherData = new RealTimeAtmosphere(); PrivateObject obj = new PrivateObject(weatherData); obj.SetFieldOrProperty("_gfscode", gfscode); obj.Invoke("DownloadData"); }