public void ReceiverOnTransponderReady(object sender, RawTransponderDataEventArgs e) { if (e.TransponderData.Count > 0) { //Receive data, calls list foreach. foreach (var data in e.TransponderData) { List(data); //Converts datastring to separate variables and appropiate types. TypeConverter(); if (_airSpace.IsInAirSpace(x, y, alt) == true) { int index = CheckIfTrackIsInList(flightNum); if (index >= 0) { calc = new TrackCalculator(Tracks[index].XCoordinate, Tracks[index].YCoordinate, x, y, Tracks[index].LastDateUpdate, dateTimeNew); newTrack = new Track(flightNum, x, y, alt, dateTimeNew, calc.CalculateCompassCourse(), calc.CalculateHorizontalVelocity()); Tracks[index] = newTrack; } else { newTrack = new Track(flightNum, x, y, alt, dateTimeNew); Tracks.Add(newTrack); } _conflictList = _separationChecker.CheckForSeparation(Tracks, newTrack); //_separationChecker = new SeparationChecker(_airSpace, _condition); } else { int index = CheckIfTrackIsInList(flightNum); if (index >= 0) { Tracks.RemoveAt(index); } } } SeparationLogEventArgs logArgs = new SeparationLogEventArgs(); logArgs.ConflictList = _conflictList; SeparationLogDataReady?.Invoke(this, logArgs); ConsoleSeparationEventArgs conArgs = new ConsoleSeparationEventArgs() { conflictList = _conflictList, tracks = Tracks }; ConsoleSeparationDataReady?.Invoke(this, conArgs); } }
public void ATMSystemUnitTests_TestForLogEventNotFired_EmptyList() { SeparationLogEventArgs testArgs = null; _uut.SeparationLogDataReady += (object o, SeparationLogEventArgs a) => { testArgs = a; }; List <string> testData = new List <string>(); RawTransponderDataEventArgs args = new RawTransponderDataEventArgs(testData); //Raise event _fakeTransponderReceiver.TransponderDataReady += Raise.EventWith(this, args); //Test event not fired Assert.That(testArgs, Is.Null); }
public void ATMSystemUnitTests_TestForLogEventFired_NonEmptyList() { SeparationLogEventArgs testArgs = null; _uut.SeparationLogDataReady += (object o, SeparationLogEventArgs a) => { testArgs = a; }; List <string> testData = new List <string>(); testData.Add("ATR423;39045;12932;14000;20151006213456789"); testData.Add("BCD123;10005;85890;12000;20151006213456789"); testData.Add("XYZ987;25059;75654;4000;20151006213456789"); RawTransponderDataEventArgs args = new RawTransponderDataEventArgs(testData); //Raise event _fakeTransponderReceiver.TransponderDataReady += Raise.EventWith(this, args); //Test event not fired Assert.That(testArgs, Is.Not.Null); }
public void SeparationLogDataHandler(object sender, SeparationLogEventArgs e) { LogMessage(e.ConflictList); }