public void HandleTrackOutsideAirspace_TrackOutsideAirspaceGetsRemoved_TrackRemoverRecivesCallWithCorrectTrack()
        {
            // ARRANGE
            List <Track> newTracks = new List <Track>();
            List <Track> oldTracks = new List <Track>();

            for (int i = 0; i < 5; i++)
            {
                Track track = new Track()
                {
                    Tag = "FlightNo" + i
                };
                newTracks.Add(track);
            }

            // Creating mock and uut
            _fakeTrackManagement = new TrackManagementMock(newTracks, oldTracks);

            _uut = new AirTrafficMonitoring.FlightManagement.FlightManagement(_fakeAirspaceController, _fakeTrackRemover, _fakeTrackManagement);

            // Adding tracks to newestTracks list via HandleTracksInsideAirspace
            Track trackToBeRemoved = new Track()
            {
                Tag = "FlightNo0"
            };
            TrackEventArgs eventArgs = new TrackEventArgs(trackToBeRemoved);

            _fakeAirspaceController.TrackInAirspace += Raise.EventWith(eventArgs);

            // ACT
            _fakeAirspaceController.TrackOutsideAirspace += Raise.EventWith(eventArgs);

            // ASSERT
            _fakeTrackRemover.Received(1).RemoveTrack(Arg.Any <List <Track> >(), trackToBeRemoved);
        }
Exemplo n.º 2
0
 public void SetUp()
 {
     _fakeFlightManagement        = Substitute.For <IFlightManagement>();
     _fakeCollisionAnalyzer       = Substitute.For <ICollisionAnalyzer>();
     _fakeSeparationStringBuilder = Substitute.For <ISeparationStringBuilder>();
     _uut = new AirTrafficMonitoring.CollisionController.CollisionController(_fakeFlightManagement, _fakeCollisionAnalyzer, _fakeSeparationStringBuilder);
 }
Exemplo n.º 3
0
 public void SetUp()
 {
     _trackRemover           = new TrackRemover();
     _fakeTrackManagement    = new TrackManagement();
     _fakeAirspaceController = Substitute.For <IAirspaceController>();
     _flightManagement       = new AirTrafficMonitoring.FlightManagement.FlightManagement(_fakeAirspaceController, _trackRemover, _fakeTrackManagement);
 }
Exemplo n.º 4
0
 public void SetUp()
 {
     _fakeCourseAnalyzer    = Substitute.For <ICourseAnalyzer>();
     _fakeVelocityAnalyzer  = Substitute.For <IVelocityAnalyzer>();
     _fakelFlightManagement = Substitute.For <IFlightManagement>();
     _uut = new AirTrafficMonitoring.FlightAnalyzer.FlightAnalyzer(_fakelFlightManagement, _fakeCourseAnalyzer, _fakeVelocityAnalyzer);
 }
        public void SetUp()
        {
            _trackRemover       = new TrackRemover();
            _trackManagement    = new TrackManagement();
            _timeSpanCalculator = new TimeSpanCalculator();
            _distanceCalculator = new DistanceCalculator();
            _velocityCalculator = new VelocityCalculator(_timeSpanCalculator, _distanceCalculator);
            _velocityAnalyzer   = new VelocityAnalyzer(_velocityCalculator);
            _compassCalculator  = new CompassCalculator();
            _courseAnalyzer     = new CourseAnalyzer(_compassCalculator);

            _altitudeDistanceCalculator = new AltitudeDistanceCalculator();
            _collisionAnalyzer          = new CollisionAnalyzer(_distanceCalculator, _altitudeDistanceCalculator);
            _separationStringBuilder    = new SeparationStringBuilder();
            _fakeFileWriter             = Substitute.For <IFileWriter>();

            _airspace                    = new Airspace();
            _airspaceTrackChecker        = new AirspaceTrackChecker(_airspace);
            _fakeTransponderDataReciever = Substitute.For <ITransponderDataReciever>();
            _airspaceController          = new AirTrafficMonitoring.AirspaceController.AirspaceController(_fakeTransponderDataReciever, _airspaceTrackChecker);

            _flightManagement    = new AirTrafficMonitoring.FlightManagement.FlightManagement(_airspaceController, _trackRemover, _trackManagement);
            _flightAnalyzer      = new AirTrafficMonitoring.FlightAnalyzer.FlightAnalyzer(_flightManagement, _courseAnalyzer, _velocityAnalyzer);
            _collisionController = new AirTrafficMonitoring.CollisionController.CollisionController(_flightManagement, _collisionAnalyzer, _separationStringBuilder);
            _logger = new AirTrafficMonitoring.CollisionController.Logger(_collisionController, "", _fakeFileWriter);
        }
 public void SetUp()
 {
     _distanceCalculator         = new DistanceCalculator();
     _altitudeDistanceCalculator = new AltitudeDistanceCalculator();
     _collisionAnalyzer          = new CollisionAnalyzer(_distanceCalculator, _altitudeDistanceCalculator);
     _separationStringBuilder    = new SeparationStringBuilder();
     _fakeFlightManagement       = Substitute.For <IFlightManagement>();
     _collisionController        = new AirTrafficMonitoring.CollisionController.CollisionController(_fakeFlightManagement, _collisionAnalyzer, _separationStringBuilder);
 }
Exemplo n.º 7
0
 public void SetUp()
 {
     _timeSpanCalculator   = new TimeSpanCalculator();
     _distanceCalculator   = new DistanceCalculator();
     _velocityCalculator   = new VelocityCalculator(_timeSpanCalculator, _distanceCalculator);
     _velocityAnalyzer     = new VelocityAnalyzer(_velocityCalculator);
     _fakeCourseAnalyzer   = Substitute.For <ICourseAnalyzer>();
     _fakeFlightManagement = Substitute.For <IFlightManagement>();
     _flightAnalyzer       = new AirTrafficMonitoring.FlightAnalyzer.FlightAnalyzer(_fakeFlightManagement, _fakeCourseAnalyzer, _velocityAnalyzer);
 }
 public void SetUp()
 {
     _trackRemover           = new TrackRemover();
     _fakeTrackManagement    = new TrackManagement();
     _fakeAirspaceController = Substitute.For <IAirspaceController>();
     _timeSpanCalculator     = new TimeSpanCalculator();
     _distanceCalculator     = new DistanceCalculator();
     _velocityCalculator     = new VelocityCalculator(_timeSpanCalculator, _distanceCalculator);
     _velocityAnalyzer       = new VelocityAnalyzer(_velocityCalculator);
     _compassCalculator      = new CompassCalculator();
     _courseAnalyzer         = new CourseAnalyzer(_compassCalculator);
     _flightManagement       = new AirTrafficMonitoring.FlightManagement.FlightManagement(_fakeAirspaceController, _trackRemover, _fakeTrackManagement);
     _flightAnalyzer         = new AirTrafficMonitoring.FlightAnalyzer.FlightAnalyzer(_flightManagement, _courseAnalyzer, _velocityAnalyzer);
 }
        public void HandleTrackInsideAirspace_HandlesTrack_EventWasRaised()
        {
            _fakeTrackManagement = Substitute.For <ITrackManagement>();
            _uut = new AirTrafficMonitoring.FlightManagement.FlightManagement(_fakeAirspaceController, _fakeTrackRemover, _fakeTrackManagement);

            bool wasRaised = false;

            _uut.FlightDataReady += (sender, args) => wasRaised = true;
            TrackEventArgs e = new TrackEventArgs(new Track());

            // ACT
            _fakeAirspaceController.TrackInAirspace += Raise.EventWith <TrackEventArgs>(e);

            // ASSERT
            Assert.That(wasRaised, Is.EqualTo(true));
        }
        public void HandleTrackOutsideAirspace_TracksOutsideAirspaceGetsRemoved_TrackRemoverRecievesCorrectNumberOfCalls(int totalTracks, int numberOfTracksToBeRemoved)
        {
            //Arrange
            //Creating list that will be added to flightmanagements private lists.
            List <Track> newTracks = new List <Track>();
            List <Track> oldTracks = new List <Track>();

            for (int i = 0; i < totalTracks; i++)
            {
                Track track = new Track()
                {
                    Tag = "FlightNo" + i
                };
                newTracks.Add(track);
            }

            //Creating mock and uut:
            _fakeTrackManagement = new TrackManagementMock(newTracks, oldTracks);
            _uut = new AirTrafficMonitoring.FlightManagement.FlightManagement(_fakeAirspaceController, _fakeTrackRemover, _fakeTrackManagement);

            //Adding tracks to newestTracks list via HandleTracksInsideAirspace

            _fakeAirspaceController.TrackInAirspace += Raise.EventWith(new TrackEventArgs(new Track()));

            //Act
            for (int i = 0; i < numberOfTracksToBeRemoved; i++)
            {
                Track trackToBeRemoved = new Track()
                {
                    Tag = "FlightNo" + i
                };
                TrackEventArgs arg = new TrackEventArgs(trackToBeRemoved);
                _fakeAirspaceController.TrackOutsideAirspace += Raise.EventWith(arg);
            }

            //Assert
            _fakeTrackRemover.Received(numberOfTracksToBeRemoved).RemoveTrack(Arg.Any <List <Track> >(), Arg.Any <Track>());
        }
 public AADispatcher(IFlightManagement flightManagement, string nodeId, ITimerService timerService)
     : base(nodeId, timerService)
 {
     _flightManagement = flightManagement;
     TimerService.FlightLandedEvent += DispatchFlightBaggage;
 }
 public FlightAnalyzer(IFlightManagement flightManagement, ICourseAnalyzer courseAnalyzer, IVelocityAnalyzer velocityAnalyzer)
 {
     flightManagement.FlightDataReady += HandleFlightsInAirspace;
     _courseAnalyzer   = courseAnalyzer;
     _velocityAnalyzer = velocityAnalyzer;
 }
 public CollisionController(IFlightManagement flightManagement, ICollisionAnalyzer collisionAnalyzer, ISeparationStringBuilder separationStringBuilder)
 {
     flightManagement.FlightDataReady += HandleFlightsInAirspace;
     _collisionAnalyzer       = collisionAnalyzer;
     _separationStringBuilder = separationStringBuilder;
 }