Exemple #1
0
        public void should_throw_exception_when_parking_boy_get_car_given_a_valid_ticket_and_two_parking_lot_and_parking_lot_A_is_managed_by_parking_boy()
        {
            var parkinglotA = new ParkingLot(_capacity);
            var parkinglotB = new ParkingLot(_capacity);
            var boy         = new SmartParkingBoy(new List <ParkingLot> {
                parkinglotA
            });
            var car    = new Car();
            var ticket = parkinglotB.Park(car);

            Assert.Throws <NotFoundException>(() => boy.GetCar(ticket));
        }
Exemple #2
0
        public void should_throw_exception_when_parking_boy_get_car_given_an_invalid_ticket_and_a_parking_lot()
        {
            var parkinglot = new ParkingLot(_capacity);
            var boy        = new SmartParkingBoy(new List <ParkingLot> {
                parkinglot
            });
            var car = new Car();

            boy.Park(car);

            Assert.Throws <NotFoundException>(() => boy.GetCar(new object()));
        }
Exemple #3
0
        public void should_get_the_right_car_when_parking_boy_get_car_given_a_valid_ticket_and_a_parking_lot()
        {
            var parkinglot = new ParkingLot(_capacity);
            var boy        = new SmartParkingBoy(new List <ParkingLot> {
                parkinglot
            });
            var car    = new Car();
            var ticket = boy.Park(car);


            var gettedCar = boy.GetCar(ticket);

            Assert.NotNull(gettedCar);
            Assert.Equal(car, gettedCar);
        }
Exemple #4
0
        public void should_get_the_right_car_when_parking_boy_get_car_given_a_valid_ticket_and_two_parking_lot_and_parking_lot_A_is_full()
        {
            var parkinglotA = new ParkingLot(_capacity);
            var parkinglotB = new ParkingLot(_capacity);
            var boy         = new SmartParkingBoy(new List <ParkingLot> {
                parkinglotA, parkinglotB
            });

            for (int i = 0; i < 20; i++)
            {
                parkinglotA.Park(new Car());
            }
            var car    = new Car();
            var ticket = boy.Park(car);

            var gettedCar = boy.GetCar(ticket);

            Assert.NotNull(gettedCar);
            Assert.Equal(car, gettedCar);
        }