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

            Assert.Same(car, manager.Pick(manager.Park(car)));
        }
        public void should_get_park_status_when_no_car_parked()
        {
            var manager = new ParkingBoyManager(new List<IParkable> { new ParkingLot(1) });
            var director = new ParkingDirector(manager);

            Assert.Equal("M 0 1\r\n  P 0 1", director.GetParkStatus());
        }
        public void should_ask_super_boy_to_park()
        {
            var car = new Car();
            var manager = new ParkingBoyManager(
                new List<IParkable> { new SuperParkingBoy(new ParkingLot()) });

            Assert.Same(car, manager.Pick(manager.Park(car)));
        }
        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 should_get_park_status_when_only_one_parkingLot_parked()
        {
            var manager = new ParkingBoyManager(new List<IParkable> { new ParkingLot(1) });
            manager.Park(new Car());

            var director = new ParkingDirector(manager);

            Assert.Equal("M 1 1\r\n  P 1 1", director.GetParkStatus());
        }
        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_pick_by_selectedBoy_when_selected_boy_park()
        {
            var car = new Car();
            var superParkingBoy = new SuperParkingBoy(new ParkingLot());
            var manager = new ParkingBoyManager(
                new List<IParkable> { superParkingBoy});

            Assert.Same(car, superParkingBoy.Pick(manager.Park(car)));
        }
        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());
        }
        public void should_park_failed_if_available_parkingLot_is_null()
        {
            var car = new Car();
            var smartParkingBoy = new SmartParkingBoy(new ParkingLot(1));
            smartParkingBoy.Park(new Car());
            var superParkingBoy = new SuperParkingBoy(new ParkingLot(1));
            superParkingBoy.Park(new Car());
            var manager = new ParkingBoyManager(
                new List<IParkable>
                {
                    smartParkingBoy, superParkingBoy
                });

            Assert.Equal(StatusCode.ParkinglotIsFull, manager.Park(car).StatusCode);
        }
Ejemplo n.º 10
0
 public ParkingDirector(ParkingBoyManager manager)
 {
     _manager = manager;
     _parkableList = manager.GetParableList();
 }
        public void should_try_to_park_in_available_parkingLot()
        {
            var car = new Car();
            var superParkingBoy = new SuperParkingBoy(new ParkingLot(1));
            superParkingBoy.Park(new Car());
            var manager = new ParkingBoyManager(
                new List<IParkable>
                {
                    superParkingBoy, new SmartParkingBoy(new ParkingLot(10))
                });

            Assert.Same(car, manager.Pick(manager.Park(car)));
        }