public void HandleFlightsInAirspace_HandlesFlights_EventWasRaised(int altitude1, int altitude2, double x1, double x2, double y1, double y2)
            {
                DateTime timeStamp = DateTime.Now;
                Track    trackOne  = new Track()
                {
                    Altitude = altitude1, XCoordinate = x1, YCoordinate = y1, TimeStamp = timeStamp, Tag = "Test1"
                };
                Track trackTwo = new Track()
                {
                    Altitude = altitude2, XCoordinate = x2, YCoordinate = y2, TimeStamp = timeStamp, Tag = "Test2"
                };


                List <Track> NewestTracks = new List <Track>();

                NewestTracks.Add(trackOne);
                NewestTracks.Add(trackTwo);

                string expectedNote = "Timestamp: " + timeStamp.ToString() + " Flight: "
                                      + trackOne.Tag + " is on collision with flight: " + trackTwo.Tag;;
                string actualNote = "";

                _collisionController.SeperationEvent += (sender, args) => actualNote = args.SeperationNote;

                _collisionController.HandleFlightsInAirspace(this, new FlightMovementEventArgs(new List <Track>(), NewestTracks));

                StringAssert.IsMatch(expectedNote, actualNote);
            }
        public void HandleFlightsInAirSpace_SeparationEventGetsLogged_EventWasLogged(int altitude1, int altitude2, double x1, double x2, double y1, double y2)
        {
            DateTime timeStamp = DateTime.Now;
            Track    trackOne  = new Track()
            {
                Altitude = altitude1, XCoordinate = x1, YCoordinate = y1, TimeStamp = timeStamp, Tag = "Test1"
            };
            Track trackTwo = new Track()
            {
                Altitude = altitude2, XCoordinate = x2, YCoordinate = y2, TimeStamp = timeStamp, Tag = "Test2"
            };


            List <Track> NewestTracks = new List <Track>();

            NewestTracks.Add(trackOne);
            NewestTracks.Add(trackTwo);

            string expectedNote = "Timestamp: " + timeStamp.ToString() + " Flight: "
                                  + trackOne.Tag + " is on collision with flight: " + trackTwo.Tag;

            _collisionController.HandleFlightsInAirspace(this, new FlightMovementEventArgs(new List <Track>(), NewestTracks));

            _fakeFileWriter.Received(1).WriteToFile("", expectedNote);
        }
Exemplo n.º 3
0
        public void HandleFlightsInAirspace_HandlesFlights_EventWasRaised(int altitude1, int altitude2, double x1, double x2, double y1, double y2)
        {
            Track trackOne = new Track()
            {
                Altitude = altitude1, XCoordinate = x1, YCoordinate = y1,
            };
            Track trackTwo = new Track()
            {
                Altitude = altitude2, XCoordinate = x2, YCoordinate = y2
            };

            List <Track> NewestTracks = new List <Track>();

            NewestTracks.Add(trackOne);
            NewestTracks.Add(trackTwo);

            int raises = 0;

            _collisionController.SeperationEvent += (sender, args) => raises++;

            _collisionController.HandleFlightsInAirspace(this, new FlightMovementEventArgs(new List <Track>(), NewestTracks));

            _fakeSeparationStringBuilder.Received(1).BuildSeperationNote(trackOne, trackTwo);
        }