Exemple #1
0
 public void AddDataPoint_GetCurrentPosition_CorrectPosition()
 {
     // Act
     _uut.AddDataPoint(_firstDataPoint);
     // Assert
     Assert.That(_uut.GetCurrentPosition(), Is.EqualTo(new Vector2(2000, 2000)));
 }
Exemple #2
0
        public void OnFlightUpdatedSeperationEventDetect_TwoFlightsSeperate_TwoEnterOneEvent()
        {
            _flight1a.GetCurrentPosition().Returns(new Vector2(5000, 7050));
            _flight1b.GetCurrentPosition().Returns(new Vector2(5000, 6960));
            _flight1c.GetCurrentPosition().Returns(new Vector2(5000, 6850));

            _flight2a.GetCurrentPosition().Returns(new Vector2(5000, 2000));
            _flight2b.GetCurrentPosition().Returns(new Vector2(5000, 2100));
            _flight2c.GetCurrentPosition().Returns(new Vector2(5000, 2200));

            _flight1a.GetCurrentAltitude().Returns(700);
            _flight1b.GetCurrentAltitude().Returns(700);
            _flight1c.GetCurrentAltitude().Returns(700);
            _flight2a.GetCurrentAltitude().Returns(600);
            _flight2b.GetCurrentAltitude().Returns(600);
            _flight2c.GetCurrentAltitude().Returns(600);

            var args1 = new FlightTracksUpdatedEventArgs(new List <IFlightTrack> {
                _flight1a, _flight2a
            });                                                                                            //Far enough
            var args2 = new FlightTracksUpdatedEventArgs(new List <IFlightTrack> {
                _flight1b, _flight2b
            });                                                                                            //too close

            //var args3 = new FlightTracksUpdatedEventArgs(new List<IFlightTrack> { _flight1c, _flight2c }); //still too close

            //Act
            _datasource.FlightTracksUpdated += Raise.EventWith(args1);
            _datasource.FlightTracksUpdated += Raise.EventWith(args2);
            //_datasource.FlightTracksUpdated += Raise.EventWith(args3);



            Assert.That(_SeperationEventCount, Is.EqualTo(1));
            Assert.That(_flightTracksUpdatedCounter, Is.EqualTo(2));
        }
        public bool TracksConflicting(IFlightTrack f1, IFlightTrack f2)
        {
            double  f1alt = f1.GetCurrentAltitude();
            double  f2alt = f2.GetCurrentAltitude();
            Vector2 f1pos = f1.GetCurrentPosition();
            Vector2 f2pos = f2.GetCurrentPosition();

            if ((Math.Abs(f1alt - f2alt) < _altitude) && Vector2.Distance(f1pos, f2pos) < _distance)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }