public void Normal_ParkingBoy_Should_Add_Error_Message_Given_Outof_Capacity() { //given var parkingLot = new ParkingLot.ParkingLot("parkingLot_1", 2); var parkingBoy = new NormalParkingBoy("parkingBoy_1", parkingLot); var car_1 = new Car("car_1"); var car_2 = new Car("car_2"); var car_3 = new Car("car_3"); //when parkingBoy.ParkCar(car_1, out _); parkingBoy.ParkCar(car_2, out _); parkingBoy.ParkCar(car_3, out var errorMessage); var expectedMessage = "Not enough position."; //then Assert.Equal(expectedMessage, errorMessage); }
public void Normal_ParkingBoy_Should_Return_Null_Given_Null_Car() { //given var parkingLot = new ParkingLot("parkingLot_1", 3); var parkingBoy = new NormalParkingBoy("parkingBoy_1", parkingLot); //when var resultGivenParkedCar = parkingBoy.ParkCar(null, out _); //then Assert.Null(resultGivenParkedCar); }
public void Normal_ParkingBoy_Should_Choose_ParkingLot_In_Order() { //given var parkingLot_1 = new ParkingLot("parkingLot_1", 2); var parkingLot_2 = new ParkingLot("parkingLot_2", 3); var parkingBoy = new NormalParkingBoy("parkingBoy_1", new List <ParkingLot>(new[] { parkingLot_1, parkingLot_2 })); var car_1 = new Car("car_1"); var car_2 = new Car("car_2"); var car_3 = new Car("car_3"); //when var parkingResult_1 = parkingBoy.ParkCar(car_1, out _); var parkingResult_2 = parkingBoy.ParkCar(car_2, out _); var parkingResult_3 = parkingBoy.ParkCar(car_3, out _); //then Assert.Equal("parkingLot_1", parkingResult_1.ParkingLotId); Assert.Equal("parkingLot_1", parkingResult_2.ParkingLotId); Assert.Equal("parkingLot_2", parkingResult_3.ParkingLotId); Assert.Equal("car_1", parkingResult_1.CarId); Assert.Equal("car_2", parkingResult_2.CarId); Assert.Equal("car_3", parkingResult_3.CarId); }
public void Normal_ParkingBoy_Should_Return_Null_Given_Parked_Car() { //given var car = new Car("car_1"); var newCustomer = new Customer("customer_1", car); var parkingLot = new ParkingLot("parkingLot_1", 3); var parkingBoy = new NormalParkingBoy("parkingBoy_1", parkingLot); //when newCustomer.PassCarToParkingBoy(parkingBoy); var resultGivenParkedCar = parkingBoy.ParkCar(car, out _); //then Assert.Null(resultGivenParkedCar); }
public void Normal_ParkingBoy_Should_Add_Error_Message_Given_Parked_Ticket() { //given var car = new Car("car_1"); var newCustomer = new Customer("customer_1", car); var parkingLot = new ParkingLot.ParkingLot("parkingLot_1", 3); var parkingBoy = new NormalParkingBoy("parkingBoy_1", parkingLot); //when var parkedTicket = parkingBoy.ParkCar(car, out _); parkingBoy.FetchCar(parkedTicket, out _); parkingBoy.FetchCar(parkedTicket, out var errorMessage); var expectedMessage = "Unrecognized parking ticket."; //then Assert.Equal(expectedMessage, errorMessage); }