示例#1
0
        public int SendVehicleTo(int garageSlot, Storage deliveryLocation)
        {
            ExeptionTracker.IsValidGarageSlot(garageSlot, this);
            ExeptionTracker.IsVehicleInside(this.garage[garageSlot]);

            var vehicle = this.garage[garageSlot];

            for (int i = 0; i < deliveryLocation.garage.Length; i++)
            {
                if (deliveryLocation.garage[i] == null)
                {
                    deliveryLocation.garage[i] = vehicle;
                    this.garage[garageSlot]    = null;
                    return(i);
                }
            }
            throw new InvalidOperationException(ExeptionTracker.NoRoomInGarage());
        }