public string UnloadVehicle(string storageName, int garageSlot)
        {
            Storage storage = this.storageRegistry.FirstOrDefault(x => x.Name == storageName);
            Vehicle vehicle = storage.GetVehicle(garageSlot);

            ErrorTracker.EmptyGarageSlot(vehicle);
            int unloadedProductsCount = storage.UnloadVehicle(garageSlot);

            return($"Unloaded {unloadedProductsCount}/{vehicle.Trunk.Count} products at {storageName}");
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public Vehicle GetVehicle(int garageSlot)
 {
     ErrorTracker.InvalidGarageSlot(this.GarageSlots, garageSlot);
     ErrorTracker.EmptyGarageSlot(this.garage[garageSlot]);
     return(this.garage[garageSlot]);
 }