コード例 #1
0
        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}");
        }
コード例 #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);
        }
コード例 #3
0
 public Vehicle GetVehicle(int garageSlot)
 {
     ErrorTracker.InvalidGarageSlot(this.GarageSlots, garageSlot);
     ErrorTracker.EmptyGarageSlot(this.garage[garageSlot]);
     return(this.garage[garageSlot]);
 }