public void ShowTracks(List <Data> d) { List <IEnumerable <string> > formattedTracks = new List <IEnumerable <string> >(); IEnumerable <string> trackInfo; lock (_prevList) { foreach (var track in d) { Data oldData = null; oldData = _prevList.FirstOrDefault(prevData => prevData.Tag == track.Tag); if (oldData != null && (track.XCord != oldData.XCord || track.YCord != oldData.YCord)) { trackInfo = _calc.FormatTrackData(track, oldData); } else { trackInfo = _calc.FormatTrackData(track, new Data("", 0, 0, 0, "0000000000000000")); } formattedTracks.Add(trackInfo); } _prevList = d; } _display.ShowTracks(formattedTracks); }
public void FormattedData() { int sec = 0; // Kan bruges til at opdatere position på nedenstående data Data data1 = new Data("timeTest1", 0, 0, 0, "201708302054" + $"{sec:00}" + "166"); Data data2 = new Data("timeTest1", 1, 0, 0, "201708302054" + $"{sec + 1:00}" + "166"); var formatted = _positionCalc.FormatTrackData(data2, data1).ToList(); Assert.IsTrue(formatted[0] == "timeTest1"); Assert.IsTrue(formatted[1] == "1"); Assert.IsTrue(formatted[2] == "0"); Assert.IsTrue(formatted[3] == "0"); Assert.IsTrue(formatted[4] == "1"); Assert.IsTrue(formatted[5] == "90"); }