예제 #1
0
        public int UnloadVehicle(int garageSlot)
        {
            ErrorTracker.FullGarage(this.IsFull);
            ErrorTracker.InvalidGarageSlot(this.GarageSlots, garageSlot);
            ErrorTracker.EmptyGarageSlot(this.garage[garageSlot]);

            Vehicle currentVehicle   = this.garage[garageSlot];
            int     uploadedProducts = 0;

            while (!currentVehicle.IsEmpty && !this.IsFull)
            {
                Product currentProduct = currentVehicle.Unload();
                this.products.Add(currentProduct);
                uploadedProducts++;
            }
            return(uploadedProducts);
        }