public void Car_Should_not_be_fetched_according_to_used_parking_ticket() { //given var parkingLot = new ParkingLot(); var parkingBoy = new ParkingBoy(); //when var numberPlate = "XX2345"; var parkingTicket = parkingBoy.Park(numberPlate, parkingLot); parkingBoy.Fetch(parkingTicket, parkingLot); var actual = parkingBoy.Fetch(parkingTicket, parkingLot); //then Assert.Empty(actual); }
public void Should_Parking_Boy_Fetch_No_Car_Given_The_Ticket_Has_Been_Used() { //given var parkedCar = new Car("N98245"); var parkingBoy = new ParkingBoy(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 ParkingBoy(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_ParkingBoyFecth_Return_No_Car_Given_Used_Tickect() { //Given var boy = new ParkingBoy("Jack"); string fectchmessage = string.Empty; var parkingLots = new List <CarLot <string, Car> >() { LotInitialize.FillLotWithCars(3), }; var ticket = "SuperPark: RJ_12784"; boy.Fetch(ticket, parkingLots, out fectchmessage); Car expected = null; //When var result = boy.Fetch(ticket, parkingLots, out fectchmessage); //Then Assert.Equal(expected, result); }
public void A_parkingLot_should_not_contain_this_car_after_fetched() { //given var parkingLot = new ParkingLot(); var parkingBoy = new ParkingBoy(); //when var numberPlate = "XX2345"; var parkingTicket = parkingBoy.Park(numberPlate, parkingLot); var actual = parkingBoy.Fetch(parkingTicket, parkingLot); //then Assert.DoesNotContain(numberPlate, parkingLot.ParkingCarsList); }
public void Should_ParkingBoy_Return_Correct_Error_Message_Given_Used_Tickect() { //Given var boy = new ParkingBoy("Jack"); string fectchmessage = string.Empty; var parkingLots = new List <CarLot <string, Car> >() { LotInitialize.FillLotWithCars(3), LotInitialize.FillLotWithCars(4), }; var ticket = "SuperPark: RJ_12784"; boy.Fetch(ticket, parkingLots, out fectchmessage); Car expectedCar = null; string expectedMessage = "Unrecognized parking ticket."; string actualMessage; //When var actualCar = boy.Fetch(ticket, parkingLots, out actualMessage); //Then Assert.Equal(expectedCar, actualCar); Assert.Equal(expectedMessage, actualMessage); }
public void Should_Parking_Boy_Fetch_No_Cars_Given_The_No_Ticket() { //given var expectedCar = new Car("N98245"); //when var parkingBoy = new ParkingBoy(new List <ParkingLot>() { new ParkingLot() }); var car = parkingBoy.Fetch(null, out _); //then Assert.Null(car); }
public void ErrorMessage_Should_be_provided_When_no_ticket_is_given() { //given var parkingLot = new ParkingLot(); var parkingBoy = new ParkingBoy(); //when var numberPlate = "XX2345"; var parkingTicket = parkingBoy.Park(numberPlate, parkingLot); parkingBoy.Fetch(null, parkingLot); var actual = parkingBoy.ErrorMessage; var expect = "Please provide your parking ticket."; //then Assert.Equal(expect, actual); }
public void ErrorMessage_Should_be_provided_When_wrong_ticket_is_given() { //given var parkingLot = new ParkingLot(); var parkingBoy = new ParkingBoy(); //when var numberPlate = "XX2345"; var parkingTicket = parkingBoy.Park(numberPlate, parkingLot); parkingBoy.Fetch("111111", parkingLot); var actual = parkingBoy.ErrorMessage; var expect = "Unrecognized parking ticket"; //then Assert.Equal(expect, actual); }
public void Should_Manager_Fetch_A_Car_Using_Ticket() { //given var expectedCar = new Car("N98245"); //when var parkingBoy = new ParkingBoy(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 ParkingBoy(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 ParkingBoy("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_Get_Error_Message_Unrecognized_parking_ticket_Given_A_Wrong_Ticket_When_Fetch_Car() { //given var guid = Guid.NewGuid(); var parkingBoy = new ParkingBoy(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_Parking_Boy_Fetch_No_Cars_Given_The_Wrong_Ticket() { //given var expectedCar = new Car("N98245"); var parkingBoy = new ParkingBoy(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_ParkingBoy_Return_Correct_Error_Message_Given_No_Tickect() { //Given var boy = new ParkingBoy("Jack"); var parkingLots = new List <CarLot <string, Car> >() { LotInitialize.FillLotWithCars(3), LotInitialize.FillLotWithCars(4), }; Car expectedCar = null; string expectedMessage = "Please provide your parking ticket."; string actualMessage; //When var actualCar = boy.Fetch(parkingLots, out actualMessage); //Then Assert.Equal(expectedCar, actualCar); Assert.Equal(expectedMessage, actualMessage); }
public void Should_ParkingBoyFecth_Return_Right_Car() { //Given var boy = new ParkingBoy("Jack"); string message = string.Empty; string fectchmessage = string.Empty; var parkingLots = new List <CarLot <string, Car> >() { LotInitialize.FillLotWithCars(3) }; var ticket = "SuperPark: RJ_12784"; boy.Park(new Car("RJ_12784"), parkingLots, out message); Car expected = parkingLots[0]["RJ_12784"]; //When var result = boy.Fetch(ticket, parkingLots, out fectchmessage); //Then Assert.Equal(expected, result); }
public void Should_Parking_Boy_Park_Mutiple_Cars_And_Fetch_The_Right_Car_Using_Ticket() { //given var expectedCar = new Car("N98245"); //when var parkingBoy = new ParkingBoy(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); }
public void Should_ParkingBoyFetch_Return_Right_Car(string plateNumber, string parkingTicket) { //Given var boy = new ParkingBoy("Jack"); string message = string.Empty; string fectchmessage = string.Empty; var fetchedCar = new Car(plateNumber); var ticket = parkingTicket; var parkingLots = new List <CarLot <string, Car> >() { new CarLot <string, Car>(), }; boy.Park(fetchedCar, parkingLots, out message); Car expected = fetchedCar; //When var result = boy.Fetch(ticket, parkingLots, out fectchmessage); //Then Assert.IsType <Car>(result); Assert.Equal(expected, result); }