public void should_return_success_first_then_return_not_found_when_try_to_pick_car_twice() { var car = new Car(); var parkingLot = new ParkingLot(1); var ticket = parkingLot.Park(car); parkingLot.Pick(ticket); var secondResult = parkingLot.Pick(ticket); Assert.Equal(null, secondResult); }
public void should_park_cars_in_order_using_multiple_parking_lot() { var car1 = new Car(); var car2 = new Car(); var parkingLot1 = new ParkingLot(1); var parkingLot2 = new ParkingLot(1); var parkingBoy = new ParkingBoy(new List<ParkingLot>() { parkingLot1, parkingLot2 }); var ticket1 = parkingBoy.Park(car1); var ticket2 = parkingBoy.Park(car2); Assert.Null(parkingLot1.Pick(ticket2)); Assert.Null(parkingLot2.Pick(ticket1)); Assert.Equal(car1, parkingLot1.Pick(ticket1)); Assert.Equal(car2, parkingLot2.Pick(ticket2)); }
public void should_pick_the_parked_car_when_park_a_car() { var car = new Car(); var parkingLot = new ParkingLot(1); var ticket = parkingLot.Park(car); Assert.Equal(car, parkingLot.Pick(ticket)); }
public void should_not_pick_a_car_from_empty_parking_lot_when_use_invalid_ticket() { var invalidTicket = 1; var parkingLot = new ParkingLot(1); var actual = parkingLot.Pick(invalidTicket); Assert.Equal(null, actual); }
public void should_park_car_by_smart_parking_boy() { var parkingLot = new ParkingLot(1); var smartParkingBoy = new SmartParkingBoy(new List<ParkingLot>(){parkingLot}); var car = new Car(); var ticket = smartParkingBoy.Park(car); Assert.Equal(car, parkingLot.Pick(ticket)); }
public void should_not_pick_a_car_when_use_invalid_ticket_and_exist_car_in_parking_lot() { var car1 = new Car(); var parkingLot = new ParkingLot(1); parkingLot.Park(car1); var invalidTicket = 1; var actual = parkingLot.Pick(invalidTicket); Assert.Equal(null, actual); }
public void should_be_able_to_park_car_when_there_is_multi_parking_lot_with_same_avaliable_space() { var parkingLot1 = new ParkingLot(1); var parkingLot2 = new ParkingLot(1); var smartParkingBoy = new SmartParkingBoy(new List<ParkingLot> {parkingLot1, parkingLot2}); var car = new Car(); var ticket = smartParkingBoy.Park(car); Assert.Equal(car,parkingLot1.Pick(ticket) ?? parkingLot2.Pick(ticket)); }
public void should_not_park_car_when_parking_lot_is_0_free_space_rate() { var parkingLot = new ParkingLot(1); parkingLot.Park(new Car()); var superParkingBoy = new SuperParkingBoy(new List<ParkingLot> { parkingLot }); var car = new Car(); var ticket = superParkingBoy.Park(car); Assert.Null(parkingLot.Pick(ticket)); }
public void should_park_car_to_parking_lot_1_if_parking_lot_1_has_more_space() { var parkingLot1 = new ParkingLot(2); var parkingLot2 = new ParkingLot(1); var car = new Car(); var smartParkingBoy = new SmartParkingBoy(new List<ParkingLot> { parkingLot1, parkingLot2 }); var ticket = smartParkingBoy.Park(car); Assert.NotEqual(car, parkingLot2.Pick(ticket)); Assert.Equal(car, parkingLot1.Pick(ticket)); }
public void should_park_car_to_parking_lot_1_if_parking_lot_1_is_not_full() { var car = new Car(); var parkingLot1 = new ParkingLot(1); var parkingLot2 = new ParkingLot(1); var parkingBoy = new ParkingBoy(new List<ParkingLot>(){parkingLot1, parkingLot2}); var ticket = parkingBoy.Park(car); Assert.Null(parkingLot2.Pick(ticket)); Assert.Equal(car, parkingLot1.Pick(ticket)); }
public void should_get_null_ticket_if_both_parking_lots_are_full() { var parkingLot1 = new ParkingLot(1); parkingLot1.Park(new Car()); var parkingLot2 = new ParkingLot(1); parkingLot2.Park(new Car()); var smartParkingBoy = new SmartParkingBoy(new List<ParkingLot> { parkingLot1, parkingLot2 }); var car = new Car(); var ticket = smartParkingBoy.Park(car); Assert.Null(ticket); Assert.NotEqual(car, parkingLot1.Pick(ticket) ?? parkingLot2.Pick(ticket)); }
public void should_park_car_when_there_is_one_parking_lot() { var parkingLot = new ParkingLot(1); var superParkingBoy = new SuperParkingBoy(new List<ParkingLot>{parkingLot}); var car = new Car(); var ticket = superParkingBoy.Park(car); Assert.Equal(car, parkingLot.Pick(ticket)); }
public void should_park_car_to_parking_lot_with_higher_free_rate() { var lowerFreeRateParkingLot = new ParkingLot(2); lowerFreeRateParkingLot.Park(new Car()); var higherFreeRateParkingLot = new ParkingLot(2); var superParkingBoy = new SuperParkingBoy(new List<ParkingLot> { lowerFreeRateParkingLot, higherFreeRateParkingLot }); var car = new Car(); var ticket = superParkingBoy.Park(car); Assert.Null(lowerFreeRateParkingLot.Pick(ticket)); Assert.Equal(car, higherFreeRateParkingLot.Pick(ticket)); }