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 async Task <GPSLog> ParseGPSLogEntries(List <GPSLogEntry> entries) { var takeoff = await _airfieldService.GetLocalAirfieldID(entries[0]); var landing = await _airfieldService.GetLocalAirfieldID(entries[entries.Count - 1]); GPSLog ret = new GPSLog() { Entries = entries, Duration = ComputeDuration(entries), TakeoffID = (takeoff.Success) ? takeoff.Value : (Guid?)null, LandingID = (landing.Success) ? landing.Value : (Guid?)null, ApproxLength = ComputeLength(entries, true), RegisteredLength = ComputeLength(entries) }; return(ret); }