static void StatusUpdater(IQueue SerialStatusUpdaterMessageBox) { Dictionary <string, ISensorLog> latestSensorData = new Dictionary <string, ISensorLog>(); Initialize(latestSensorData); // initialize dictionary to set expected values //GPSLog gps = new GPSLog("G123,456,789"); string banana; ISensorLog sensorlog; while (true) { while (SerialStatusUpdaterMessageBox.TryDequeue(out banana)) { if (banana[0] == 'G') //perhaps put all of this into a factory { sensorlog = new GPSLog(banana); } else { sensorlog = new GPSLog("G9,999,999"); //do nothing for now } latestSensorData[sensorlog.Identifier] = sensorlog; } // Console.WriteLine(banana); // gps.UpdateValues(); Thread.Sleep(200); } }
public void CreateGPSSensor_ArgumentMissing_ThrowsArgumentException() { string rawData = "G45.462257,-73.573379"; Assert.Throws<System.ArgumentException>( delegate { GPSLog gps = new GPSLog(rawData); } , "Command sent: G45.462257,-73.573379"); }
public void CreateGPSSensor_ValidCommandReceived_InitializesProperly() { string rawData = "G45.462257,-73.573379,32.50"; string latitudeExpected = "45.462257"; string longitudeExpected = "-73.573379"; string altitudeExpected = "32.50"; GPSLog gps = new GPSLog(rawData); Assert.AreEqual(latitudeExpected, gps.Latitude); Assert.AreEqual(longitudeExpected, gps.Longitude); Assert.AreEqual(altitudeExpected, gps.Altitude); Assert.IsTrue(gps.IsUpdated); }
public static void Initialize(Dictionary <string, ISensorLog> dict) { GPSLog garbage = new GPSLog("G000,000,000"); dict.Add("G", garbage); }
public static void Initialize(Dictionary<string, ISensorLog> dict) { GPSLog garbage = new GPSLog("G000,000,000"); dict.Add("G", garbage); }
static void StatusUpdater(IQueue SerialStatusUpdaterMessageBox) { Dictionary<string, ISensorLog> latestSensorData = new Dictionary<string, ISensorLog>(); Initialize(latestSensorData); // initialize dictionary to set expected values //GPSLog gps = new GPSLog("G123,456,789"); string banana; ISensorLog sensorlog; while (true) { while (SerialStatusUpdaterMessageBox.TryDequeue(out banana)) { if (banana[0] == 'G') //perhaps put all of this into a factory { sensorlog = new GPSLog(banana); } else { sensorlog = new GPSLog("G9,999,999"); //do nothing for now } latestSensorData[sensorlog.Identifier] = sensorlog; } // Console.WriteLine(banana); // gps.UpdateValues(); Thread.Sleep(200); } }