예제 #1
0
        public void Test_DeleteFlight()
        {
            // Setup
            Location location = new Location(38.112375, 23.879437, DateTime.UtcNow);

            List <Segment> segments = new List <Segment>();

            segments.Add(new Segment(31.922629, 31.522594, 50)); // Egypt
            segments.Add(new Segment(32.426506, 34.743033, 50)); // Cyprus
            segments.Add(new Segment(26.209199, 35.055211, 50)); // Greece
            FlightPlan flightPlan = new FlightPlan(8, "Company", location, segments);

            var stubRemoteServersConnector = new RemoteServersConnector();
            var mockFlightsManager         = new FlightsManager(stubRemoteServersConnector);

            mockFlightsManager.AddFlightPlan(flightPlan);
            List <Flight> flights           = mockFlightsManager.GetRelativeFlights(DateTime.UtcNow, false);
            string        flightId          = flights.ToArray()[0].Flight_Id;
            var           flightsController = new FlightsController(mockFlightsManager);

            // Act
            IActionResult delAction = flightsController.DeleteFlight(flightId);

            // Assert
            Assert.IsType <OkResult>(delAction);
            Assert.Empty(mockFlightsManager.GetRelativeFlights(DateTime.UtcNow, false));
        }