Example #1
0
        public void return_null_when_pick_up_a_vehicle_not_in_any_parking_lot_managed_by_him()
        {
            var vehicleParked = new Vehicle();
            var parkingLots   = new ParkingLot[1] {
                new ParkingLot(1)
            };
            var parkingBoy      = new GraduateParkingBoy(parkingLots);
            var vehicleReturned = parkingBoy.PickUp(new Ticket(parkingLots[0], 0));

            Assert.Null(vehicleReturned);
        }
Example #2
0
        public void return_the_correct_vehicle_when_pick_up_with_a_valid_ticket()
        {
            var vehicleParked = new Vehicle();
            var parkingLots   = new ParkingLot[1] {
                new ParkingLot(1)
            };
            var parkingBoy      = new GraduateParkingBoy(parkingLots);
            var ticket          = parkingBoy.Park(vehicleParked);
            var vehicleReturned = parkingBoy.PickUp(ticket);

            Assert.Same(vehicleParked, vehicleReturned);
        }
Example #3
0
        public void return_null_when_pick_up_with_a_ticket_from_a_parking_lot_not_managed_by_him()
        {
            var parkingLots = new ParkingLot[1] {
                new ParkingLot(1)
            };
            var parkingBoy        = new GraduateParkingBoy(parkingLots);
            var anotherParkingLot = new ParkingLot(1);

            parkingBoy.Park(new Vehicle());
            var ticket = anotherParkingLot.Park(new Vehicle());

            Assert.Null(parkingBoy.PickUp(ticket));
        }