Пример #1
0
        public void should_park_car_fail_if_all_parkingLots_are_full()
        {
            var parkingBoy = new ParkingBoy(new ParkingLot(1));

            parkingBoy.Park(new Car());

            Assert.Equal(StatusCode.ParkinglotIsFull, parkingBoy.Park(new Car()).StatusCode);
        }
        public void should_get_park_status_when_one_parkingBoy_parked()
        {
            var parkingBoy = new ParkingBoy(new ParkingLot(2));
            var manager = new ParkingBoyManager(new List<IParkable> {new ParkingLot(1), parkingBoy});

            parkingBoy.Park(new Car());
            var director = new ParkingDirector(manager);
            Assert.Equal("M 1 3\r\n  P 0 1\r\n  B 1 2\r\n    P 1 2", director.GetParkStatus());
        }
        public void should_get_park_status_with_multiple_parkingBoy_parked()
        {
            var parkingBoy = new ParkingBoy(new ParkingLot(2), new ParkingLot(3));
            var manager = new ParkingBoyManager(new List<IParkable> { new ParkingLot(1), parkingBoy, new ParkingBoy(new ParkingLot(2)) });

            parkingBoy.Park(new Car());
            var director = new ParkingDirector(manager);

            Assert.Equal("M 1 8\r\n  P 0 1\r\n  B 1 5\r\n    P 1 2\r\n    P 0 3\r\n  B 0 2\r\n    P 0 2", director.GetParkStatus());
        }
Пример #4
0
        public void parkingLot_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, parkingLot.Pick(parkingInfo.ParkingToken));
        }
Пример #5
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));
        }