public void given_a_parking_lot_when_parking_two_car_then_I_can_pick_all_of_them() { var parkingLot = new OOParkingLot(2); var firstCar = new Car("Car One"); var secondCar = new Car("Second One"); parkingLot.Park(firstCar); var secondCarId = parkingLot.Park(secondCar); Assert.AreSame(secondCar, parkingLot.Pick(secondCarId)); }
public void given_a_parking_lot_with_one_space_when_I_park_the_first_car_and_pick_the_first_car_then_I_can_park_the_second_one() { var parkingLot = new OOParkingLot(1); var firstCar = new Car("first car"); var secondCar = new Car("second car"); var firstCarId = parkingLot.Park(firstCar); parkingLot.Pick(firstCarId); var secondCarId = parkingLot.Park(secondCar); Assert.AreSame(secondCar, parkingLot.Pick(secondCarId)); }
public void given_a_parking_lot_when_park_a_car_then_I_can_pick_a_car() { var p = new OOParkingLot(1); var car = new Car("car"); var carId = p.Park(car); Assert.AreSame(car, p.Pick(carId)); }
public void given_a_parking_lot_with_no_empty_space_when_parking_a_car_then_I_can_not_park() { var parkingLot = new OOParkingLot(0); var car = new Car("car"); var carId = parkingLot.Park(car); Assert.IsNull(carId); }
public void given_a_parking_lot_when_parking_a_car_then_I_can_only_pick_one() { var parkingLot = new OOParkingLot(1); var myCar = new Car("my own car is unique"); var myCarId = parkingLot.Park(myCar); parkingLot.Pick(myCarId); Assert.IsNull(parkingLot.Pick(myCarId)); }
given_a_parking_lot_and_a_parking_boy_when_park_a_car_in_parking_lot_directly_then_parking_boy_can_pick_the_car () { var parkingLot = new OOParkingLot(1); var parkingBoy = new ParkingBoy(parkingLot); var myCar = new Car("a"); var carId = parkingLot.Park(myCar); Assert.AreSame(myCar, parkingBoy.Pick(carId)); }
public void given_a_parking_manager_with_a_super_parking_boy_with_two_parking_lot_and_a_smart_boy_with_a_parking_lot_which_parked_a_car_managed_by_a_parking_director_then_the_director_could_print_right_report() { var superParkingBoy = new SuperParkingBoy(new OOParkingLot(1), new OOParkingLot(1)); var smartBoyParkingLot = new OOParkingLot(1); var smartParkingBoy = new SmartParkingBoy(smartBoyParkingLot); var parkingDirector = new ParkingDirector(new ParkingManager(smartParkingBoy, superParkingBoy)); smartBoyParkingLot.Park(new Car("car")); var report = parkingDirector.OutPutByStrategy(); Assert.AreEqual("M 2 1\r\n\tB1 0 1\r\n\t\tP 0 1\r\n\tB2 2 0\r\n\t\tP 1 0\r\n\t\tP 1 0", report); }
public void given_first_parkingLot_with_two_space_and_second_parkingLot_with_one_space_and_a_smart_parking_boy_when_smart_boy_park_a_car_then_the_car_in_the_first_parkingLot() { var firstParkinglot = new OOParkingLot(2); var secondParkinglot = new OOParkingLot(2); var parkedCar = new Car("parked car"); secondParkinglot.Park(parkedCar); var smartParkingBoy = new SmartParkingBoy(firstParkinglot, secondParkinglot); var car = new Car("car"); var carId = smartParkingBoy.Park(car); Assert.AreSame(car, firstParkinglot.Pick(carId)); }
public void given_two_parkinglot_and_the_first_parkinglot_emptyRate_is_smaller_than_the_second_one_when_super_boy_park_a_car_then_the_second_parkinglot_could_pick_the_car() { var firstPrakingLot = new OOParkingLot(3); var secondPrakingLot = new OOParkingLot(4); var car = new Car("car"); var parkedCarInFirstParkingLot = new Car("car parked in the first parkinglot"); var parkedCarInSecondParkingLot = new Car("car parked in the second parkinglot"); firstPrakingLot.Park(parkedCarInFirstParkingLot); secondPrakingLot.Park(parkedCarInSecondParkingLot); var superBoy = new SuperParkingBoy(firstPrakingLot, secondPrakingLot); var carId = superBoy.Park(car); Assert.AreSame(car, secondPrakingLot.Pick(carId)); }