示例#1
0
        public void HandleTrackOutsideAirspace_TrackExistsInNewestTracks_TrackWasRemoved()
        {
            //Arrange
            //Adding elements to private lists inside flightmanagement
            for (int i = 0; i < 10; i++)
            {
                TrackEventArgs e = new TrackEventArgs(new Track()
                {
                    Tag = "FlightNo " + i
                });
                _flightManagement.HandleTrackInsideAirspace(this, e);
            }

            //Creating the track that should be removed:
            Track track = new Track()
            {
                Tag = "FlightNo 0"
            };
            TrackEventArgs arg = new TrackEventArgs(track);
            //Creating a list that will be copied upon calling HandleTrackInsideAirspace.
            List <Track> newestTracks = new List <Track>();

            _flightManagement.FlightDataReady += (sender, args) => newestTracks = args.NewestTracks;

            //Act
            _flightManagement.HandleTrackOutsideAirspace(this, arg);

            //Assert
            //Copying private list with newests tracks that will be asserted on
            _flightManagement.HandleTrackInsideAirspace(this, new TrackEventArgs(new Track()));

            Assert.That(newestTracks.Count(p => p.Tag == track.Tag), Is.EqualTo(0));
        }