public void should_not_pickup_car_twice() { var parkinglot = new Parkinglot(); var parkingToken = parkinglot.Park(new Car()); parkinglot.Pick(parkingToken); var carPickUp = parkinglot.Pick(parkingToken); Assert.Null(carPickUp); }
public void should_pick_car_after_the_car_parked() { Parkinglot parkinglot = new Parkinglot(); Car carPickup = parkinglot.Pick(parkinglot.Park(new Car())); Assert.NotNull(carPickup); }
public void should_not_pick_with_wrong_parkingToken() { var parkinglot = new Parkinglot(); parkinglot.Park(new Car()); var parkingToken = "123324"; Assert.Null(parkinglot.Pick(parkingToken)); }
public void should_park_car_when_only_one_parkinglot() { var parkinglot = new Parkinglot(); var parkingBoy = ParkingBoyFactory.CreateParkingBoy(parkinglot); var car = new Car(); var parkingToken = parkingBoy.Park(car); Assert.Same(car, parkinglot.Pick(parkingToken)); }
public void should_parked_in_higher_vacancy_rate_when_no_car_parked_before_with_different_init() { var higherVacancyRateParkinglot = new Parkinglot(2); var lowerVacancyRateParkinglot = new Parkinglot(3); var superParkingBoy = ParkingBoyFactory.CreateSuperParkingBoy(higherVacancyRateParkinglot,lowerVacancyRateParkinglot); var car = new Car(); var parkingToken = superParkingBoy.Park(car); Assert.Same(car, higherVacancyRateParkinglot.Pick(parkingToken)); }
public void should_park_car_sequently_when_first_parkinglot_is_full_and_second_not() { var firstFullParkinglot = new Parkinglot(1); firstFullParkinglot.Park(new Car()); var secondNotFullParkinglot = new Parkinglot(1); var parkingBoy = ParkingBoyFactory.CreateParkingBoy(firstFullParkinglot, secondNotFullParkinglot); var car = new Car(); var parkingToken = parkingBoy.Park(car); Assert.Same(car, secondNotFullParkinglot.Pick(parkingToken)); }
public void should_park_in_high_available_stalls_when_no_car_parked_before_with_same_init() { var parkinglot = new Parkinglot(1); var parkingBoy = ParkingBoyFactory.CreateSmartParkingBoy( parkinglot, new Parkinglot(1)); var car = new Car(); var token = parkingBoy.Park(car); Assert.Same(car, parkinglot.Pick(token)); }
public void should_park_in_high_available_stalls_when_no_car_parked_before_with_differet_init_count() { var moreAvailableStalls = new Parkinglot(2); var parkingBoy = ParkingBoyFactory.CreateSmartParkingBoy( new Parkinglot(1), moreAvailableStalls); var car = new Car(); var token = parkingBoy.Park(car); Assert.Same(car, moreAvailableStalls.Pick(token)); }
public void should_pick_right_car_when_mutiple_cars_parked() { Parkinglot parkinglot = new Parkinglot(); parkinglot.Park(new Car()); Car qq = new Car(); var parkingTokenForQQ = parkinglot.Park(qq); parkinglot.Park(new Car()); var carPickup = parkinglot.Pick(parkingTokenForQQ); Assert.Same(qq, carPickup); }
public void should_park_in_high_available_stalls_when_parked_differently_before_with_same_init() { var lessAvailableStalls = new Parkinglot(2); lessAvailableStalls.Park(new Car()); var moreAvailableStall = new Parkinglot(2); var parkingBoy = ParkingBoyFactory.CreateSmartParkingBoy( lessAvailableStalls, moreAvailableStall); var car = new Car(); var token = parkingBoy.Park(car); Assert.Same(car, moreAvailableStall.Pick(token)); }
public void should_park_in_his_parkinglot() { var parkinglot = new Parkinglot(); var parkingManager = new ParkingManager( ParkingBoyFactory.CreateParkingBoy(new Parkinglot(0)), ParkingBoyFactory.CreateSmartParkingBoy(new Parkinglot(0)), ParkingBoyFactory.CreateSuperParkingBoy(new Parkinglot(0)), parkinglot); var car = new Car(); var token = parkingManager.Park(car); Assert.Same(car, parkinglot.Pick(token)); }
public void should_park_the_car_in_more_available_stalls_parkinglot() { var littleAvailableStallsParkinglot = new Parkinglot(2); littleAvailableStallsParkinglot.Park(new Car()); var moreAvailableStallsParkinglot = new Parkinglot(4); moreAvailableStallsParkinglot.Park(new Car()); var smartParkingBoy = ParkingBoyFactory.CreateSmartParkingBoy(littleAvailableStallsParkinglot, moreAvailableStallsParkinglot); var car = new Car(); var parkingToken = smartParkingBoy.Park(car); Assert.Same(car, moreAvailableStallsParkinglot.Pick(parkingToken)); }