public void Initalise() { // Initialise an EventCollection collection = new EventCollection(); // Add four Events in the shape of a square Drop drop1 = new Drop(); drop1.Coordinate = new Coordinate(10, 10, 0); collection.Add(drop1); Drop drop2 = new Drop(); drop2.Coordinate = new Coordinate(10, 20, 0); collection.Add(drop2); Fail fail1 = new Fail(); fail1.Coordinate = new Coordinate(20, 10, 0); collection.Add(fail1); Fail fail2 = new Fail(); fail2.Coordinate = new Coordinate(20, 20, 0); collection.Add(fail2); }
/// <summary> /// This method will return an event collection of events from the given KML /// file in the constructor of this object. /// </summary> /// <returns>A collection of events</returns> public EventCollection GetCallLogs() { EventCollection calls = new EventCollection(); while (reader.Read()) { // Get the Coordinate Coordinate coordinate = ReadCoordinate(); // Move to the ExtendedData Space reader.ReadToNextSibling("ExtendedData"); //Get the additional data elements String device = GetSimpleData("device"); String pin = GetSimpleData("pin"); String timestamp = GetSimpleData("timestamp"); String reference = GetSimpleData("reference"); String type = GetSimpleData("type"); String start_rat = GetSimpleData("start_rat"); String end_rat = GetSimpleData("end_rat"); String start_mix_band = GetSimpleData("start_mix_band"); String end_mix_band = GetSimpleData("end_mix_band"); String start_rrc_state = GetSimpleData("start_rrc_state"); // Create a new Call Log Object Event callLog = null; // Force the call log to be a type switch (type) { case "Call Drop": callLog = new Drop(); break; case "Setup Failure": callLog = new Fail(); break; case "Call Success": callLog = new Success(); break; default: break; } // Add additional attributes & add to the list if (callLog != null) { callLog.Device = device; callLog.Pin = pin; callLog.Timestamp = DateTime.Parse(timestamp); callLog.Reference = Boolean.Parse(reference); callLog.StartRat = start_rat; callLog.EndRat = end_rat; callLog.StartMixBand = start_mix_band; callLog.EndMixBand = end_mix_band; callLog.StartRRCState = start_rrc_state; callLog.Coordinate = coordinate; calls.Add(callLog); } } return calls; }
public void UpdateCentroidTest() { // Setup a new Collection EventCollection col = new EventCollection(); // Check the centroid has been initalised Assert.AreEqual(0, col.Centroid.Latitude); Assert.AreEqual(0, col.Centroid.Latitude); Assert.AreEqual(0, col.Centroid.Altitude); // Add four Events in the shape of a square Drop drop1 = new Drop(); drop1.Coordinate = new Coordinate(10, 10, 0); col.Add(drop1); Drop drop2 = new Drop(); drop2.Coordinate = new Coordinate(10, 20, 0); col.Add(drop2); Fail fail1 = new Fail(); fail1.Coordinate = new Coordinate(20, 10, 0); col.Add(fail1); Fail fail2 = new Fail(); fail2.Coordinate = new Coordinate(20, 20, 0); col.Add(fail2); // Check the centroid has been updated Assert.AreEqual(15, col.Centroid.Longitude); Assert.AreEqual(15, col.Centroid.Latitude); Assert.AreEqual(0, col.Centroid.Altitude); }