예제 #1
0
        public void HandleFlightsInAirspace_AnalyzesVelocityForOneMatchingTrack_VelocityIsCorrect(int numberOfFlightsInNewestTracks, int secondsBetweenTimestamps, double firstXCoordinate, double secondXCoordinate, double firstYCoordinate, double secondYCoordinate, double expectedVelocity)
        {
            List <Track> OldestTracks   = new List <Track>();
            List <Track> NewestTracks   = new List <Track>();
            DateTime     firstDateTime  = DateTime.Now;
            DateTime     secondDateTime = firstDateTime.AddSeconds(secondsBetweenTimestamps);

            Track trackToBeCompared = new Track()
            {
                Tag = "ASE2018", TimeStamp = secondDateTime, XCoordinate = firstXCoordinate, YCoordinate = firstYCoordinate
            };

            NewestTracks.Add(trackToBeCompared);
            for (int i = 0; i < numberOfFlightsInNewestTracks - 1; i++)
            {
                Track track = new Track()
                {
                    Tag = "FlightNo " + i
                };
                NewestTracks.Add(track);
            }

            Track trackOne = new Track()
            {
                Tag = "ASE2018", TimeStamp = firstDateTime, XCoordinate = secondXCoordinate, YCoordinate = secondYCoordinate
            };

            OldestTracks.Add(trackOne);

            FlightMovementEventArgs e = new FlightMovementEventArgs(OldestTracks, NewestTracks);

            _flightAnalyzer.HandleFlightsInAirspace(this, e);

            Assert.That(NewestTracks.Find(x => x.Tag == trackOne.Tag).HorizontalVelocity, Is.EqualTo(expectedVelocity).Within(0.5));
        }
        public void AnalyzeCourse_AnalyzesCourseForMatchingTrack_CourseIsCorrect(int numberOfFlightsInNewestTracks, double x1, double x2, double y1, double y2, double expected)
        {
            List <Track> OldestTracks = new List <Track>();
            List <Track> NewestTracks = new List <Track>();

            Track trackToBeCompared = new Track()
            {
                Tag = "ASE2018", XCoordinate = x2, YCoordinate = y2
            };

            NewestTracks.Add(trackToBeCompared);

            for (int i = 0; i < numberOfFlightsInNewestTracks - 1; i++)
            {
                Track track = new Track()
                {
                    Tag = "FlightNo " + i
                };
                NewestTracks.Add(track);
            }

            Track trackOne = new Track()
            {
                Tag = "ASE2018", XCoordinate = x1, YCoordinate = y1
            };

            OldestTracks.Add(trackOne);


            FlightMovementEventArgs e = new FlightMovementEventArgs(OldestTracks, NewestTracks);

            _flightAnalyzer.HandleFlightsInAirspace(this, e);

            Assert.That(NewestTracks.Find(x => x.Tag == trackOne.Tag).CompassCourse, Is.EqualTo(expected).Within(0.5));
        }