public void parkingLot_should_pick_after_manager_park()
        {
            var car = new Car();
            var parkingLot = new ParkingLot(1);
            var manager = new ParkingBoyManager(new List<IParkable> { parkingLot});

            Assert.Same(car, parkingLot.Pick(manager.Park(car).ParkingToken));
        }
        public void smartBoy_should_get_car_after_smartBoy_park()
        {
            var bmw = new Car();
            var parkingLot = new ParkingLot();
            var smartBoy = new SmartParkingBoy(parkingLot);

            var parkingInfo = smartBoy.Park(bmw);

            Assert.Same(bmw, smartBoy.Pick(parkingInfo));
        }
        public void parkingLot_should_pick_success_after_superBoy_park()
        {
            var car = new Car();
            var parkinglot = new ParkingLot();
            var superBoy = new SuperParkingBoy(parkinglot);

            var parkingInfo = superBoy.Park(car);

            Assert.Same(car, parkinglot.Pick(parkingInfo.ParkingToken));
        }
예제 #4
0
        public void parkingBoy_should_pick_car_success_after_parkingBoy_park_car()
        {
            var car = new Car();
            var parkingLot = new ParkingLot(1);
            var parkingBoy = new ParkingBoy(parkingLot);

            var parkingInfo = parkingBoy.Park(car);

            Assert.Same(car, parkingBoy.Pick(parkingInfo));
        }
        public void should_park_in_bigger_parkingLot_for_different_size_empty_parkingLots()
        {
            var bmw = new Car();
            var parkingLot1 = new ParkingLot(1);
            var parkingLot2 = new ParkingLot(2);
            var smartBoy = new SmartParkingBoy(parkingLot1, parkingLot2);

            var bmwParkingInfo = smartBoy.Park(bmw);

            Assert.Same(bmw, parkingLot2.Pick(bmwParkingInfo.ParkingToken));
        }
        public void superBoy_should_park_failed_if_all_parkingLots_are_full()
        {
            var bmw = new Car();
            var audi = new Car();
            var parkinglot = new ParkingLot(1);
            var superBoy = new SuperParkingBoy(parkinglot);

            superBoy.Park(bmw);

            Assert.Equal(StatusCode.ParkinglotIsFull, superBoy.Park(audi).StatusCode);
        }
예제 #7
0
        public void should_park_to_first_available_parkingLot_for_mutiple_available_parkingLots()
        {
            var bmw = new Car();
            var parkingLot1 = new ParkingLot(1);
            var parkingLot2 = new ParkingLot(1);
            var parkingBoy = new ParkingBoy(parkingLot1, parkingLot2);

            var bmwParkingInfo = parkingBoy.Park(bmw);

            Assert.Same(bmw, parkingLot1.Pick(bmwParkingInfo.ParkingToken));
        }
예제 #8
0
        public static ParkingInfo GetParkingInfo(Car car, ParkingLot availableParkingLot)
        {
            if (availableParkingLot == null)
            {
                return new ParkingInfo(Guid.Empty, Guid.Empty, StatusCode.ParkinglotIsFull);
            }

            var parkingInfo = availableParkingLot.Park(car);
            return new ParkingInfo(
                availableParkingLot.ParkingLotGuid,
                parkingInfo.ParkingToken,
                parkingInfo.StatusCode);
        }
        public void should_park_in_parkinglot_with_high_vacancy_rate_for_different_size_parkingLots()
        {
            var bmw = new Car();
            var audi = new Car();
            var parkingLot1 = new ParkingLot(10);
            var parkingLot2 = new ParkingLot(20);
            var superboy = new SuperParkingBoy(parkingLot1, parkingLot2);

            parkingLot2.Park(bmw);
            var parkingInfo = superboy.Park(audi);

            Assert.Same(audi, parkingLot1.Pick(parkingInfo.ParkingToken));
        }
        public void should_park_in_parkinglot_with_high_available_spots_for_same_size_parkingLots()
        {
            var bmw = new Car();
            var audi = new Car();
            var parkingLot1 = new ParkingLot(10);
            var parkingLot2 = new ParkingLot(10);
            var superboy = new SuperParkingBoy(parkingLot1, parkingLot2);

            parkingLot1.Park(bmw);
            var parkingInfo = superboy.Park(audi);

            Assert.Same(audi, parkingLot2.Pick(parkingInfo.ParkingToken));
        }
        public void should_park_in_parkingLot_with_high_availability_for_multiple_parkinglots_with_different_availibility()
        {
            var bmw = new Car();
            var audi = new Car();
            var benz = new Car();
            var parkingLot1 = new ParkingLot(2);
            var parkingLot2 = new ParkingLot(3);
            var smartBoy = new SmartParkingBoy(parkingLot1, parkingLot2);

            parkingLot1.Park(bmw);
            parkingLot2.Park(audi);

            var parkingInfo = smartBoy.Park(benz);

            Assert.Same(benz, parkingLot2.Pick(parkingInfo.ParkingToken));
        }