public void Normal_ParkingBoy_Should_Return_Null_Given_No_Ticket_Or_Wrong_Ticket() { //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 resultOfNoTicket = parkingBoy.FetchCar(null, out _); var resultOfWrongTicket = parkingBoy.FetchCar(new ParkingTicket("another_parkingBoy", "new_Car", "new_Customer", "another_ParkingLot"), out _); //then Assert.Null(resultOfNoTicket); Assert.Null(resultOfWrongTicket); }
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); }
public void Normal_ParkingBoy_Should_Add_Error_Message_Given_No_Ticket() { //given var parkingLot = new ParkingLot.ParkingLot("parkingLot_1", 3); var parkingBoy = new NormalParkingBoy("parkingBoy_1", parkingLot); //when parkingBoy.FetchCar(null, out var errorMessage); var expectedMessage = "Please provide your parking ticket."; //then Assert.Equal(expectedMessage, errorMessage); }
public void Normal_ParkingBoy_Should_Add_Error_Message_Given_Wrong_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 newCustomer.PassCarToParkingBoy(parkingBoy); var resultOfWrongTicket = parkingBoy.FetchCar(new ParkingTicket("another_parkingBoy", "new_Car", "new_Customer", "another_ParkingLot"), out var errorMessage); var expectedMessage = "Unrecognized parking ticket."; //then Assert.Equal(expectedMessage, errorMessage); }