public void Update_AddTracks_VelocityIsCalculated(int expectecTrack,
                                                          int idx1, int idx2)
        {
            // Arrange
            _velocityCalculator.Calculate(Arg.Is <List <Track> >(
                                              x => x.Contains(_tracks[idx1]) && x.Contains(_tracks[idx2])))
            .Returns(5.5);

            // Act
            _uut.Update(_tracks);

            // Assert
            Assert.That(_tracks[expectecTrack].Velocity, Is.EqualTo(5.5));
        }
Example #2
0
        public List <Track> Update(List <Track> tracks)
        {
            _tagsManager.Manage(ref _tagsInAirspace, tracks);

            foreach (var track in tracks)
            {
                if (_tagsInAirspace.Contains(track.Tag))
                {
                    _tracksInAirspace.Add(track);
                }
            }

            _tracksManager.Manage(ref _tracksInAirspace, _tagsInAirspace);
            foreach (var tag in _tagsInAirspace)
            {
                var calcTracks = new List <Track>();
                foreach (var track in _tracksInAirspace)
                {
                    if (track.Tag == tag)
                    {
                        calcTracks.Add(track);
                    }
                }

                foreach (var track in tracks)
                {
                    if (track.Tag == tag)
                    {
                        track.Velocity = _velocityCalculator.Calculate(calcTracks);
                        track.Course   = _courseCalculator.Calculate(calcTracks);
                    }
                }
            }

            _seperationEventChecker.Check(_tracksInAirspace);
            _tracksManager.Manage(ref tracks, _tagsInAirspace);

            return(tracks);
        }