Exemple #1
0
        void should_not_pick_a_car_when_the_car_has_been_picked_by_parking_boy()
        {
            const string carId           = "ABC123";
            var          car             = new Car(carId);
            var          parkingLot      = new ParkingLot();
            var          smartParkingBoy = new SmartParkingBoy(new List <ParkingLot> {
                parkingLot
            });

            smartParkingBoy.Park(car);
            Car pickedCar = smartParkingBoy.Pick(carId);

            Assert.Same(car, pickedCar);

            pickedCar = smartParkingBoy.Pick(carId);
            Assert.Null(pickedCar);
        }
Exemple #2
0
        void should_can_pick_the_car_when_parking_boy_park_a_car()
        {
            var parkingBoy = new SmartParkingBoy(new ParkingLot(10));
            var car        = new Car();
            var token      = parkingBoy.Park(car);

            var pickedCar = parkingBoy.Pick(token);

            Assert.Same(car, pickedCar);
        }
        public void should_pick_the_same_car_after_parked_it()
        {
            var parkingLot      = new ParkingLot(1);
            var smartParkingBoy = new SmartParkingBoy(parkingLot);
            var car             = new Car();
            var token           = smartParkingBoy.Park(car);

            var pickedCar = smartParkingBoy.Pick(token);

            pickedCar.Should().BeSameAs(car);
        }
Exemple #4
0
        public void should_be_able_to_pick_car_by_smart_parking_boy()
        {
            var car        = new Car();
            var parkingLot = new ParkingLot(1);
            var parkingBoy = new SmartParkingBoy(new List <ParkingLot>()
            {
                parkingLot
            });

            var ticket = parkingLot.Park(car);

            Assert.Equal(car, parkingBoy.Pick(ticket));
        }
Exemple #5
0
        public void should_pick_car_from_parking_lot_2_by_smart_parking_boy_if_the_car_is_in_parking_lot_2()
        {
            var parkingLot1 = new ParkingLot(1);
            var parkingLot2 = new ParkingLot(1);
            var parkingBoy  = new SmartParkingBoy(new List <ParkingLot>()
            {
                parkingLot1, parkingLot2
            });
            var car = new Car();

            var ticket = parkingLot2.Park(car);

            Assert.Equal(car, parkingBoy.Pick(ticket));
        }
Exemple #6
0
        void should_pick_the_car_by_parking_boy_when_park_a_car_to_parking_lot()
        {
            const string carId           = "ABC123";
            var          car             = new Car(carId);
            var          parkingLot      = new ParkingLot();
            var          smartParkingBoy = new SmartParkingBoy(new List <ParkingLot> {
                parkingLot
            });

            parkingLot.Park(car);

            Car pickedCar = smartParkingBoy.Pick(carId);

            Assert.Same(car, pickedCar);
        }
Exemple #7
0
        given_a_smart_boy_with_empty_parking_lot_and_one_space_parking_lot_and_a_super_boy_with_one_space_parking_lot_both_managed_by_parking_manager_when_parking_manager_park_the_car_then_super_boy_could_pick_the_car
            ()
        {
            var emptyParkinglot          = new OOParkingLot(0);
            var firstNotEmptyParkingLot  = new OOParkingLot(1);
            var secondNotEmptyParkingLot = new OOParkingLot(1);
            var smartBoy = new SmartParkingBoy(emptyParkinglot, firstNotEmptyParkingLot);
            var superBoy = new SuperParkingBoy(secondNotEmptyParkingLot);
            var manager  = new ParkingManager(smartBoy, superBoy);
            var car      = new Car("car");

            var carId = manager.Park(car);

            Assert.AreSame(car, smartBoy.Pick(carId));
        }