private void HandleTrackEvent(object sender, TrackDataEventArgs e) { Console.ClearConsole(); OccurrenceTracks.Clear(); try { if (e.TrackData == null) { throw new NullReferenceException("empty Track list"); } var listOfTracks = e.TrackData; foreach (var track in listOfTracks) { Formatter.FormatTracks(track, Tracks); Detector.CheckOccurrence(track, Tracks); } Display.RenderOccurences(OccurrenceTracks); Display.RenderTrack(Tracks); } catch (NullReferenceException ex) { Exception.Handle(ex); } }
public void ConstructorBuilderTest() { var track = new Track { CurrentAltitude = 600, CurrentCompassCourse = 200, CurrentHorizontalVelocity = 300, CurrentPositionX = 10000, CurrentPositionY = 10000, Tag = "aaaaaa", TimeStamp = new DateTime(2020, 10, 10), }; var track1 = new Track { CurrentAltitude = 800, CurrentCompassCourse = 300, CurrentHorizontalVelocity = 200, CurrentPositionX = 5000, CurrentPositionY = 200, Tag = "bbbbbb", TimeStamp = new DateTime(2020, 10, 11), }; var list = new List <Track> { track, track1 }; var uut = new TrackDataEventArgs(list); Assert.That(uut.TrackData, Is.EquivalentTo(list)); }
public void SetUp() { _decoder = Substitute.For <ITrackDecoding>(); //Rigtige Klasser _uut = new Logger(); _Event = new SeparationEvent(); _Track1 = new TrackData() { Tag = "TAG1", X = 1000, Y = 2000, Altitude = 3000, Course = 30, Velocity = 23, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Track2 = new TrackData() { Tag = "TAG2", X = 1000, Y = 2000, Altitude = 3000, Course = 30, Velocity = 23, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Update = new Update(_decoder); //Lister _Tracklist = new List <ITracks>() { _Track1, _Track2 }; _fakeTransponderData = new TrackDataEventArgs(_Tracklist); //Substitueret _CalcDistance = Substitute.For <ICalcDistance>(); _calcCourse = Substitute.For <ICalcCourse>(); _calcVelocity = Substitute.For <ICalcVelocity>(); _monitor = Substitute.For <IMonitors>(); _decoder.TrackDataReadyForCalculation += (o, args) => _Tracklist = args.TrackData; }
//Vores filter og update sidder her, med separationseventet hvis tags ikke er det samme private void ArgOnTrackDataReadyForCalculation(object sender, TrackDataEventArgs trackDataEventArgs) { if (OldTracklist.Count != 0) { UpdatesTrack(trackDataEventArgs.TrackData); } else { ListInit(trackDataEventArgs.TrackData); } ListRenew(trackDataEventArgs.TrackData); }
public void SetUp() { _decoder = Substitute.For <ITrackDecoding>(); //Rigtige Klasser _Track1 = new TrackData() { Tag = "TAG1", X = 10000, Y = 21000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 4000" }; _Track2 = new TrackData() { Tag = "TAG1", X = 50000, Y = 20000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 1111" }; _Track3 = new TrackData() { Tag = "TAG1", X = 100, Y = 21000, Altitude = 3000, Course = 0, Velocity = 100, FormattedTimestamp = "14-05-2018 17:18 53 4000" }; _CalcDistance = new CalcDistance(); _calcCourse = new CalcCourse(); _calcVelocity = new CalcVelocity(); _monitor = new Monitor(); _uut = new Update(_decoder); //Lister _Tracklist = new List <ITracks>() { _Track1, _Track2 }; _fakeTransponderData = new TrackDataEventArgs(_Tracklist); //Substitueret _logger = Substitute.For <ILog>(); _output = Substitute.For <IOutput>(); _print = Substitute.For <IPrints>(); _Separation = Substitute.For <ISeparation>(); _decoder.TrackDataReadyForCalculation += (o, args) => _Tracklist = args.TrackData; }
public void Setup() { _track1 = Substitute.For <ITracks>(); _track2 = Substitute.For <ITracks>(); _decoder = Substitute.For <ITrackDecoding>(); receivedTrackData = new List <ITracks>(); _uut = new Update(_decoder); _calcDistance = Substitute.For <ICalcDistance>(); _calcCourse = Substitute.For <ICalcCourse>(); _calcVelocity = Substitute.For <ICalcVelocity>(); _logger = Substitute.For <ILog>(); _separation = Substitute.For <ISeparation>(); _monitor = Substitute.For <IMonitors>(); //Tilsæt ny data _track1.Tag = "Tag1"; _track1.Altitude = 500; _track1.X = 20000; _track1.Y = 40000; //_track1.Course = 0; _track1.Timestamp = new DateTime(20180419152929150); //_track1.Velocity = 0; _track2.Tag = "Tag1"; _track2.Altitude = 600; _track2.X = 40000; _track2.Y = 90000; //_track2.Course = 0; _track2.Timestamp = new DateTime(20180419152929100); //_track2.Velocity = 0; _fakeTransponderData = new TrackDataEventArgs(new List <ITracks>()); _fakeTransponderData.TrackData.Add(Substitute.For <ITracks>()); _fakeTransponderData.TrackData.Add(Substitute.For <ITracks>()); //Her bliver eventet sat til at være lige med receivedTrackData _decoder.TrackDataReadyForCalculation += (o, args) => receivedTrackData = args.TrackData; }