public void PumpFuelToTank(float i_AmountOfFuelToAdd, FuelType.eFuelType i_PumpFuelType) { if (i_PumpFuelType == m_FuelType) { AddMoreEnergy(i_AmountOfFuelToAdd); } }
public void CheckingFuelTypeInput(string i_LicenseNumberToReful, string i_FuelType) { Vehicle vehicleToCheck; m_VehicleInTheGarage.TryGetValue(i_LicenseNumberToReful.GetHashCode(), out vehicleToCheck); if (vehicleToCheck.EnergySource is FuelTank) { FuelTank FuelTankTochek = vehicleToCheck.EnergySource as FuelTank; FuelType.eFuelType fuelTypeToFill = FuelType.ParseFromString(i_FuelType); if (FuelTankTochek._FuelType != fuelTypeToFill) { throw new ArgumentException(string.Format("The vehicle with the license number {0} does not support {1} fuel type.", i_LicenseNumberToReful, fuelTypeToFill.ToString())); } } }
internal void Refueling(float i_AmountOfFuelToAdd, FuelType.eFuelType i_FuelTypeToAdd) { float minToLoad = 0; float maxToLoad = MaxSourceAmount - CurrentSourceAmount; if (i_FuelTypeToAdd != _FuelType) { throw new ArgumentException(string.Format("The vehicle does not support {0} fuel type.", i_FuelTypeToAdd)); } if (i_AmountOfFuelToAdd >= minToLoad && i_AmountOfFuelToAdd <= maxToLoad) { CurrentSourceAmount += i_AmountOfFuelToAdd; } else { throw new ValueOutOfRangeException(maxToLoad, maxToLoad, string.Format("Maximum fuel to load is- {0} liters.", maxToLoad)); } }
public FuelTank(FuelType.eFuelType i_FuelType, int i_MaxTankCapacity) : base(i_MaxTankCapacity) { m_FuelType = i_FuelType; }