public void should_be_able_to_pick_two_cars_when_parked_two_cars_to_a_not_full_parking_lot() { var parkingLot = new ParkingLot(2); var theFirstCar = new Car(); var theFirstTicket = parkingLot.Park(theFirstCar); var theSecondCar = new Car(); var theSecondTicket = parkingLot.Park(theSecondCar); Assert.Same(theFirstCar, parkingLot.Pick(theFirstTicket)); Assert.Same(theSecondCar, parkingLot.Pick(theSecondTicket)); }
public void should_be_able_to_park_car_when_a_parking_lot_is_no_longer_full() { var parkingLot = new ParkingLot(1); var ticket = parkingLot.Park(new Car()); parkingLot.Pick(ticket); var anotherCar = new Car(); var anotherTicket = parkingLot.Park(anotherCar); Assert.Same(anotherCar, parkingLot.Pick(anotherTicket)); }
public void should_fail_to_park_car_when_a_parking_lot_is_full() { var parkingLot = new ParkingLot(1); parkingLot.Park(new Car()); Assert.Throws <ParkingLotFullException>( () => { parkingLot.Park(new Car()); }); }
public void should_be_able_to_park_and_pick_cars_to_a_not_full_parking_lot() { var parkingLot = new ParkingLot(10); var theFirstCar = new Car(); var theFirstTicket = parkingLot.Park(theFirstCar); var theSecondCar = new Car(); var theSecondTicket = parkingLot.Park(theSecondCar); Assert.Same(theFirstCar, parkingLot.Pick(theFirstTicket)); var theThirdCar = new Car(); parkingLot.Park(theThirdCar); Assert.Same(theSecondCar, parkingLot.Pick(theSecondTicket)); }
public void should_be_able_to_pick_the_same_car_when_park_a_car_to_a_parking_lot() { var parkingLot = new ParkingLot(1); var car = new Car(); var ticket = parkingLot.Park(car); Assert.Same(car, parkingLot.Pick(ticket)); }
public void should_fail_to_park_car_when_all_parking_lots_are_full() { var parkingLot1 = new ParkingLot(1); parkingLot1.Park(new Car()); var parkingLot2 = new ParkingLot(1); parkingLot2.Park(new Car()); var parkingBoy = ParkingBoy.Smart(parkingLot1, parkingLot2); Assert.Throws <AllParkingLotsFullException>(() => parkingBoy.Park(new Car())); }
public void should_be_able_to_pick_the_same_car_from_the_second_parking_lot_when_smart_parking_boy_has_two_parking_lot_with_first_one_full_and_park_the_car() { var parkingLot1 = new ParkingLot(1); parkingLot1.Park(new Car()); var parkingLot2 = new ParkingLot(1); var parkingBoy = ParkingBoy.Smart(parkingLot1, parkingLot2); var car = new Car(); var ticket = parkingBoy.Park(car); Assert.Same(car, parkingLot2.Pick(ticket)); }
public void should_park_the_car_to_the_parking_lot_with_highest_vacancy_rate_and_no_relationship_with_the_parking_lot_order() { var parkingLotWithLowVacancyRate = new ParkingLot(4); parkingLotWithLowVacancyRate.Park(new Car()); var parkingLotWithHighVacancyRate = new ParkingLot(2); var parkingBoy = ParkingBoy.Super(parkingLotWithLowVacancyRate, parkingLotWithHighVacancyRate); var car = new Car(); var ticket = parkingBoy.Park(car); Assert.Same(car, parkingLotWithHighVacancyRate.Pick(ticket)); }
public void should_fail_to_pick_the_same_car_when_a_car_is_no_longer_in_a_parking_lot() { var parkingLot = new ParkingLot(1); var ticket = parkingLot.Park(new Car()); parkingLot.Pick(ticket); Assert.Throws <NoCarException>( () => { parkingLot.Pick(ticket); }); }