public void TakeOfReturnsCorrectString()
        {
            IAirport airport = new Airport();

            airport.AddTrip(new Trip("source", "Destination", new LightAirplane()));
            airport.AddPassenger(new Passenger("az"));
            airport.AddPassenger(new Passenger("ti"));
            IFlightController flightController = new FlightController(airport);

            string result = flightController.TakeOff();

            Assert.That(result, Is.EqualTo("sourceDestination2:\r\nSuccessfully transported 0 passengers from source to Destination.\r\nConfiscated bags: 0 (0 items) => $0"));
        }
예제 #2
0
        public void Test1()
        {
            IPassenger passenger1 = new Passenger("Pesho");

            IBag bag1 = new Bag(passenger1, new IItem[] { new Toothbrush(), new Jewelery() });
            IBag bag2 = new Bag(passenger1, new IItem[] { new CellPhone(), new Laptop() });

            IAirplane airplane = new LightAirplane();

            ITrip trip = new Trip("Sofia", "London", airplane);

            trip.Airplane.AddPassenger(passenger1);

            trip.Airplane.LoadBag(bag1);
            trip.Airplane.LoadBag(bag2);

            IAirport airport = new Airport();

            airport.AddTrip(trip);
            airport.AddPassenger(passenger1);
            airport.AddCheckedBag(bag1);


            FlightController flightController = new FlightController(airport);


            string result = flightController.TakeOff();

            string expectedResult = "SofiaLondon1:\r\n" +
                                    "Successfully transported 1 passengers from Sofia to London.\r\n" +
                                    "Confiscated bags: 0 (0 items) => $0";

            Assert.That(result, Is.EqualTo(expectedResult));
        }
예제 #3
0
        public void Tester()
        {
            var airport  = new Airport();
            var airplane = new LightAirplane();
            var trip     = new Trip("Yambol", "Sofia", airplane);

            for (int i = 0; i <= 5; i++)
            {
                var current = new Passenger("Passenger" + i);
                trip.Airplane.AddPassenger(current);
                airport.AddPassenger(current);
            }

            var passenger = airport.GetPassenger("Passenger1");
            var bag       = new Bag(passenger, new IItem[] { new Colombian() });

            passenger.Bags.Add(bag);

            var completedTrip = new Trip("a", "b", new MediumAirplane());

            completedTrip.Complete();

            airport.AddTrip(trip);
            airport.AddTrip(completedTrip);

            var flightController = new FlightController(airport);

            var actualResult = flightController.TakeOff();

            var expectedResult = "YambolSofia1:\r\nOverbooked! Ejected Passenger1\r\nConfiscated 1 bags ($50000)\r\nSuccessfully transported 5 passengers from Yambol to Sofia.\r\nConfiscated bags: 1 (1 items) => $50000";

            Assert.That(trip.IsCompleted, Is.True);
            Assert.That(actualResult, Is.EqualTo(expectedResult));
        }