public void Should_Smart_Parking_Boy_Fetch_No_Car_Given_The_Ticket_Has_Been_Used() { //given var parkedCar = new Car("N98245"); var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); var ticket = parkingBoy.Park(parkedCar, out _); parkingBoy.Fetch(ticket, out _); //when var car = parkingBoy.Fetch(ticket, out _); //then Assert.Null(car); }
public void Should_Get_Error_Message_Unrecognized_parking_ticket_Given_A_Used_Ticket_When_Fetch_Car() { //given var parkedCar = new Car("N98245"); var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); var ticket = parkingBoy.Park(parkedCar, out _); parkingBoy.Fetch(ticket, out _); //when var errorMessage = string.Empty; parkingBoy.Fetch(ticket, out errorMessage); //then Assert.Equal("Unrecognized parking ticket.", errorMessage); }
public void Should_Smart_Parking_Boy_Fetch_No_Cars_Given_The_No_Ticket() { //given var expectedCar = new Car("N98245"); //when var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); var car = parkingBoy.Fetch(null, out _); //then Assert.Null(car); }
public void Should_Smart_Parking_Boy_Fetch_A_Car_Using_Ticket() { //given var expectedCar = new Car("N98245"); //when var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); var ticket = parkingBoy.Park(expectedCar, out _); var car = parkingBoy.Fetch(ticket, out _); //then Assert.Equal(expectedCar.GetType(), car.GetType()); }
public void Should_Get_Error_Message_Given_A_Null_Ticket_When_Fetch_Car() { //given var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); //when var errorMessage = string.Empty; parkingBoy.Fetch(null, out errorMessage); //then Assert.Equal("Please provide your parking ticket.", errorMessage); }
public void Should_Fetch_Return_Car_With_Valid_ParkingTicket() { // given // given var parkedCar = new Car("JAA8888"); var parkingLot1 = new ParkingLot("ParkingLotOne"); var parkingLot2 = new ParkingLot("ParkingLotOne"); var parkingBoy = new SmartParkingBoy("Jack", parkingLot1, parkingLot2); var parkingTicket = parkingBoy.Park(parkedCar); // when var fetchedCar = parkingBoy.Fetch(parkingTicket); // then Assert.IsType <Car>(fetchedCar); Assert.Equal(fetchedCar, parkedCar); }
public void Should_Smart_Parking_Boy_Fetch_No_Cars_Given_The_Wrong_Ticket() { //given var expectedCar = new Car("N98245"); var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); parkingBoy.Park(expectedCar, out _); var wrongTicket = new Ticket("wrongNumber"); //when var car = parkingBoy.Fetch(wrongTicket, out _); //then Assert.Null(car); }
public void Should_Get_Error_Message_Unrecognized_parking_ticket_Given_A_Wrong_Ticket_When_Fetch_Car() { //given var guid = Guid.NewGuid(); var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot(10) }); var wrongTicket = new Ticket("wrongNumber"); //when var errorMessage = string.Empty; parkingBoy.Fetch(wrongTicket, out errorMessage); //then Assert.Equal("Unrecognized parking ticket.", errorMessage); }
public void Should_Smart_Parking_Boy_Park_Mutiple_Cars_And_Fetch_The_Right_Car_Using_Ticket() { //given var expectedCar = new Car("N98245"); //when var parkingBoy = new SmartParkingBoy(new List <ParkingLot>() { new ParkingLot() }); var carList = new List <Car>() { new Car("car1"), new Car("car2"), new Car("car3") }; carList.ForEach(car => parkingBoy.Park(car, out _)); var ticket = parkingBoy.Park(expectedCar, out _); var car = parkingBoy.Fetch(ticket, out _); //then Assert.Equal(expectedCar, car); }