public void should_success_to_pick_the_parked_car_once_and_fail_to_pick_the_second_time()
        {
            var    parkingLog = new ParkingLog(1);
            var    firstCar   = new Car("1");
            string carId      = parkingLog.Park(firstCar);

            Assert.Same(firstCar, parkingLog.Pick(carId));
            Assert.Null(parkingLog.Pick(carId));
        }
        public void should_fail_to_pick_the_not_parked_car()
        {
            var    parkingLog = new ParkingLog(1);
            var    firstCar   = new Car("1");
            var    secondCar  = new Car("2");
            string carId      = parkingLog.Park(firstCar);

            Assert.Same(firstCar, parkingLog.Pick(carId));
            Assert.Null(parkingLog.Pick(secondCar.carId));
        }
        public void should_pick_two_car_successfully_when_park_two_car()
        {
            var    parkingLog  = new ParkingLog(12);
            var    firstCar    = new Car("1");
            var    secondCar   = new Car("2");
            string firstCarId  = parkingLog.Park(firstCar);
            string secondCarId = parkingLog.Park(secondCar);

            Assert.Same(firstCar, parkingLog.Pick(firstCarId));
            Assert.Same(secondCar, parkingLog.Pick(secondCarId));
        }
        public void should_pick_the_same_car_use_car_number_successfully()
        {
            var    parkingLog = new ParkingLog(1);
            var    car        = new Car("1");
            string carId      = parkingLog.Park(car);

            Assert.Same(car, parkingLog.Pick(carId));
        }
        public void should_park_the_first_car_successfully_and_fail_to_park_the_second_car()
        {
            var parkingLog = new ParkingLog(1);
            var firstCar   = new Car("1");
            var secondCar  = new Car("2");

            Assert.Equal(firstCar.carId, parkingLog.Park(firstCar));
            Assert.Equal("The Parking Lot is full, can't park any more!", parkingLog.Park(secondCar));
            Assert.Same(firstCar, parkingLog.Pick(firstCar.carId));
        }
예제 #6
0
        public void should_park_the_car_to_the_only_one_parking_log_and_then_pick_the_car_from_the_parking_lot()
        {
            var parkingLogs = new List <ParkingLog>();
            var parkingLog  = new ParkingLog(1);

            parkingLogs.Add(parkingLog);
            var smartBoy  = new SmartBoy(parkingLogs);
            var car       = new Car("12345");
            var parkCarId = smartBoy.Park(car);

            Assert.Same(car, parkingLog.Pick(parkCarId));
        }
예제 #7
0
        public void should_park_the_car_to_the_first_parking_log_when_the_two_has_same_free()
        {
            var parkingLogs = new List <ParkingLog>();
            var parkingLog1 = new ParkingLog(1);
            var parkingLog2 = new ParkingLog(1);

            parkingLogs.Add(parkingLog1);
            parkingLogs.Add(parkingLog2);
            var smartBoy  = new SmartBoy(parkingLogs);
            var car       = new Car("12345");
            var parkCarId = smartBoy.Park(car);

            Assert.Equal(car, parkingLog1.Pick(parkCarId));
            Assert.Same(null, parkingLog2.Pick(parkCarId));
        }