예제 #1
0
        void should_park_car_and_get_ticket_when_parking_boy_park_a_car()
        {
            var parkingBoy = new ParkingBoy(new List <ParkingLot>
            {
                new ParkingLot(true)
            });
            var car    = new Car("lisence");
            var ticket = parkingBoy.Park(car);

            Assert.NotNull(ticket);
        }
예제 #2
0
        void should_user_get_the_car_given_parkingboy_parked_car_When_user_pick_the_car_with_valid_ticket()
        {
            var car        = new Car("lisence");
            var parkingLot = new ParkingLot(true);
            var parkingBoy = new ParkingBoy(new List <ParkingLot>
            {
                parkingLot
            });
            var availableTicket = parkingBoy.Park(car);
            var returnedCar     = parkingLot.Take(availableTicket);

            Assert.NotNull(returnedCar);
            Assert.Equal(car.Lisence, returnedCar.Lisence);
        }
예제 #3
0
        void should_park_car_in_B_given_parking_boy_is_in_parking_lot_A_and_parking_lot_B_B_is_available_when_he_park_car()
        {
            var car         = new Car("lisence");
            var parkingLotA = new ParkingLot(false);
            var parkingLotB = new ParkingLot(true);
            var parkingBoy  = new ParkingBoy(new List <ParkingLot>
            {
                parkingLotA,
                parkingLotB
            });
            var ticket = parkingBoy.Park(car);

            Assert.NotNull(ticket);
            Assert.True(parkingLotB.hasCar(car));
            Assert.False(parkingLotA.hasCar(car));
        }