Exemplo n.º 1
0
        public void park_vehicle_to_parking_lots_according_to_the_given_order()
        {
            var parkingLots = new ParkingLot[2] {
                new ParkingLot(1), new ParkingLot(1)
            };
            var parkingBoy = new GraduateParkingBoy(parkingLots);
            var ticket1    = parkingBoy.Park(new Vehicle());
            var ticket2    = parkingBoy.Park(new Vehicle());

            Assert.Same(parkingLots[0], ticket1.ParkingLot);
            Assert.Same(parkingLots[1], ticket2.ParkingLot);
        }
Exemplo n.º 2
0
        public void return_null_when_park_a_vehicle_and_there_no_empty_slot_in_any_parking_lots()
        {
            var parkingLots = new ParkingLot[1] {
                new ParkingLot(0)
            };
            var parkingBoy     = new GraduateParkingBoy(parkingLots);
            var fromParkingBoy = parkingBoy.Park(new Vehicle());

            Assert.Null(fromParkingBoy);
        }
Exemplo n.º 3
0
        public void return_a_ticket_when_park_a_vehicle_and_there_is_a_empty_slot_in_one_of_parking_lots()
        {
            var parkingLots = new ParkingLot[1] {
                new ParkingLot(1)
            };
            var parkingBoy     = new GraduateParkingBoy(parkingLots);
            var fromParkingBoy = parkingBoy.Park(new Vehicle());

            Assert.IsType <Ticket>(fromParkingBoy);
            Assert.Same(parkingLots[0], fromParkingBoy.ParkingLot);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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));
        }