Ejemplo n.º 1
0
        public void SetUp()
        {
            _flightTracksUpdatedCounter    = 0;
            _enterExitEventDetectedCounter = 0;
            _enteredCounter          = 0;
            _exitedCounter           = 0;
            _enterExitEventsDetected = new List <EnterExitEvent>();

            _datasource = Substitute.For <IFlightTrackManager>();
            _datasource.FlightTracksUpdated += (sender, args) => _flightTracksUpdatedCounter++;

            _uut = new EnterExitEventDetector(_datasource);
            _uut.EnterExitEventDetected += (sender, args) => {
                _enterExitEventsDetected.Add(args.Event);
                _lastEnterExitEventDetected = args.Event;
                _enterExitEventDetectedCounter++;
                if (args.Event.Entered)
                {
                    _enteredCounter++;
                }
                else
                {
                    _exitedCounter++;
                }
            };

            _flight1 = Substitute.For <IFlightTrack>();
            _flight2 = Substitute.For <IFlightTrack>();
            _flight1.GetTag().Returns("TAG123");
            _flight1.GetLastUpdatedAt().Returns(DateTime.Now);
            _flight2.GetTag().Returns("TAG456");
            _flight2.GetLastUpdatedAt().Returns(DateTime.Now);
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            _dataSource             = Substitute.For <IFlightTrackManager>();
            _area                   = Substitute.For <IAirspaceArea>();
            _airspaceManager        = new AirspaceManager(_dataSource, _area);
            _enterExitEventDetector = new EnterExitEventDetector(_airspaceManager);
            _uut = new EnterExitEventController(_enterExitEventDetector);

            _dataSource.FlightTracksUpdated += (o, args) => _inputEventCounter++;
            _uut.EnterExitEventsUpdated     += (o, args) =>
            {
                _lastReceivedEnterExitEvents = args.ActiveEvents;
                _outputEventCounter++;
            };

            _flight1 = Substitute.For <IFlightTrack>();
            _flight2 = Substitute.For <IFlightTrack>();
            _flight1.GetTag().Returns("TAG123");
            _flight1.GetLastUpdatedAt().Returns(DateTime.Now);
            _flight2.GetTag().Returns("TAG456");
            _flight2.GetLastUpdatedAt().Returns(DateTime.Now);

            //Use IAirspaceArea substitute to manually emulate flight airspace filtering (alt = 1 inside, alt = 0 outside)
            _area.IsInside(Arg.Any <int>(), Arg.Any <int>(), Arg.Is <int>(x => x == 1)).Returns(true);
            _area.IsInside(Arg.Any <int>(), Arg.Any <int>(), Arg.Is <int>(x => x == 0)).Returns(false);
        }
        public void SetUp()
        {
            _dataSource = Substitute.For <IFlightTrackManager>();
            _dataSource.FlightTracksUpdated += (o, args) => _inputEventCounter++;
            _enterExitEventDetector          = new EnterExitEventDetector(_dataSource);
            _uut = new EnterExitEventController(_enterExitEventDetector);
            _uut.EnterExitEventsUpdated += (o, args) =>
            {
                _lastReceivedEnterExitEvents = args.ActiveEvents;
                _outputEventCounter++;
            };

            _flight1 = Substitute.For <IFlightTrack>();
            _flight2 = Substitute.For <IFlightTrack>();
            _flight1.GetTag().Returns("TAG123");
            _flight1.GetLastUpdatedAt().Returns(DateTime.Now);
            _flight2.GetTag().Returns("TAG456");
            _flight2.GetLastUpdatedAt().Returns(DateTime.Now);
        }
Ejemplo n.º 4
0
 public EnterExitEvent(IFlightTrack flight, bool entered)
     : base("Airspace", "Flight " + flight.GetTag() + " has " + ((entered) ? "entered" : "left") + " airspace at " + flight.GetLastUpdatedAt().ToLongTimeString())
 {
     Flight  = flight;
     Entered = entered;
 }