Exemplo n.º 1
0
 public void AnalyzeVelocity(List <Track> OldestTracks, List <Track> NewestTracks)
 {
     foreach (var OldTrack in OldestTracks)
     {
         foreach (var NewTrack in NewestTracks)
         {
             if (NewTrack.Tag == OldTrack.Tag)
             {
                 _velocityCalculator.CalculateVelocity(OldTrack, NewTrack);
             }
         }
     }
 }
        public void CalculateVelocity_CalculatesVelocity_VelocityIsCorrect(int secondsBetweenTimestamps, int firstXCoordinate, int secondXCoordinate, int firstYCoordinate, int secondYCoordinate, double expectedVelocity)
        {
            DateTime firstDateTime  = DateTime.Now;
            DateTime secondDateTime = firstDateTime.AddSeconds(secondsBetweenTimestamps);
            Track    trackOne       = new Track()
            {
                TimeStamp = firstDateTime, XCoordinate = firstXCoordinate, YCoordinate = firstYCoordinate
            };
            Track trackTwo = new Track()
            {
                TimeStamp = secondDateTime, XCoordinate = secondXCoordinate, YCoordinate = secondYCoordinate
            };

            _velocityCalculator.CalculateVelocity(trackOne, trackTwo);

            Assert.That(trackTwo.HorizontalVelocity, Is.EqualTo(expectedVelocity).Within(0.5));
        }
Exemplo n.º 3
0
 public void OnMovementInAirspaceDetected(object sender, TrackEventArgs trackEventArgs)
 {
     if (!_airspace.PlanesInAirspace.ContainsKey(trackEventArgs.Track.Tag))
     {
         _airspace.PlanesInAirspace.Add(trackEventArgs.Track.Tag, new List <Track>()
         {
             trackEventArgs.Track
         });
     }
     else
     {
         var planeMovementDetected = _airspace.PlanesInAirspace[trackEventArgs.Track.Tag];
         planeMovementDetected.AddToSlidingWindowList(trackEventArgs.Track, 2);
         _velocityCalculator.CalculateVelocity(planeMovementDetected);
         _degreesCalculator.CalculateDegrees(planeMovementDetected);
     }
     _trackLogging.LogTrack(trackEventArgs.Track);
 }
        public void CalculateVelocity_CalculatesVelocity_VelocityIsCorrect(int distance, int secondsBetweenTimestamps, double expectedVelocity)
        {
            _fakeDistanceCalculator
            .CalculateDistance(Arg.Any <double>(), Arg.Any <double>(), Arg.Any <double>(), Arg.Any <double>())
            .Returns(distance);
            DateTime firstDateTime  = DateTime.Now;
            DateTime secondDateTime = firstDateTime.AddSeconds(secondsBetweenTimestamps);
            Track    trackOne       = new Track()
            {
                TimeStamp = firstDateTime
            };
            Track trackTwo = new Track()
            {
                TimeStamp = secondDateTime
            };

            _velocityCalculator.CalculateVelocity(trackOne, trackTwo);

            Assert.That(trackTwo.HorizontalVelocity, Is.EqualTo(expectedVelocity).Within(0.5));
        }