示例#1
0
        public void should_to_stop_and_pick_up_car_when_park_have_one_empty_parking_position()
        {
            Park park = new Park(1);
            Car car = new Car("JP123");

            Assert.True(park.StopCar(car));
            Assert.Same(car, park.PickUpCar(car.CarNumber));
        }
示例#2
0
        public void should_can_stop_and_pick_up_when_two_park_both_have_empty_parking_position()
        {
            Park park = new Park(1);
            Car car = new Car("JP123");
            ParkingBoy boy = new ParkingBoy(park, new Park(1));

            Assert.True(boy.StopCar(car));
            Assert.Same(car, park.PickUpCar(car.CarNumber));
        }
示例#3
0
        public void should_not_to_pick_up_car_when_car_number_not_right()
        {
            Car car = new Car("JP123");
            Park park = new Park(1);
            park.StopCar(car);

            Car otherCar = new Car("JP456");
            Assert.Same(null, park.PickUpCar(otherCar.CarNumber));
        }
示例#4
0
        public void should_can_stop_and_pick_up_when_first_park_full_and_second_park_empty()
        {
            Park firstPark = new Park(0);
            Park secondPark = new Park(1);
            Car car = new Car("JP123");
            ParkingBoy boy = new ParkingBoy(firstPark, secondPark);

            Assert.True(boy.StopCar(car));
            Assert.Same(car, secondPark.PickUpCar(car.CarNumber));
        }
        public void should_success_to_stop_car()
        {
            Park park = new Park(1);
            Car car = new Car("JP123");
            ParkingManager manager = new ParkingManager(new List<Park> { park }, null);

            manager.StopCar(car);

            Assert.Same(car, park.PickUpCar(car.CarNumber));
        }
        public void should_stopped_to_park()
        {
            Park park = new Park(1);
            Car car = new Car("JP123");
            SuperParkingBoy boy = new SuperParkingBoy(park);

            boy.StopCar(car);

            Assert.Same(car, park.PickUpCar(car.CarNumber));
        }
        public void should_not_stop_when_park_have_zero_position()
        {
            Park park = new Park(0);
            SuperParkingBoy boy = new SuperParkingBoy(park);

            Car car = new Car("JP456");
            boy.StopCar(car);

            Assert.Same(null, park.PickUpCar(car.CarNumber));
        }
        public void should_stopped_to_more_empty_poisition_park_when_two_parks_have_different_empty_position()
        {
            Park lessEmptyPoisitionPark = new Park(1);
            Park moreEmptyPoisitionPark = new Park(2);
            Car car = new Car("JP123");
            SmartParkingBoy boy = new SmartParkingBoy(lessEmptyPoisitionPark, moreEmptyPoisitionPark);

            boy.StopCar(car);

            Assert.Same(car, moreEmptyPoisitionPark.PickUpCar(car.CarNumber));
        }
        public void should_stopped_to_first_park_when_two_parks_have_same_empty_position()
        {
            Park firstPark = new Park(1);
            Park secondPark = new Park(1);
            Car car = new Car("JP123");
            SmartParkingBoy boy = new SmartParkingBoy(firstPark, secondPark);

            boy.StopCar(car);

            Assert.Same(car, firstPark.PickUpCar(car.CarNumber));
        }
示例#10
0
        public void should_success_to_ask_parkingboy_to_stop_car_when_one_boy()
        {
            Park park = new Park(1);
            Car car = new Car("JP123");
            ParkingBoy parkingBoy = new ParkingBoy(park);
            ParkingManager manager = new ParkingManager(null, new List<ParkingBoyBase> { parkingBoy });

            manager.StopCar(car);

            Assert.Same(car, park.PickUpCar(car.CarNumber));
        }
        public void should_pick_up_car_from_first_park_when_two_parks_have_same_empty_rate()
        {
            Park firstPark = new Park(1);
            Park secondPark = new Park(1);
            Car car = new Car("JP123");
            SuperParkingBoy boy = new SuperParkingBoy(firstPark, secondPark);

            boy.StopCar(car);

            Assert.Same(car, firstPark.PickUpCar(car.CarNumber));
        }
        public void should_pick_up_from_more_empty_rate_park_when_two_parks_have_different_empty_rate()
        {
            Park lessEmptyRatePark = new Park(2);
            Park moreEmptyRatePark = new Park(1);
            lessEmptyRatePark.StopCar(new Car("JP123"));

            SuperParkingBoy boy = new SuperParkingBoy(lessEmptyRatePark, moreEmptyRatePark);

            Car car = new Car("JP456");
            boy.StopCar(car);

            Assert.Same(car, moreEmptyRatePark.PickUpCar(car.CarNumber));
        }