예제 #1
0
        public override string ToString()
        {
            return(string.Format(@"{0}
Fuel type:{1}",
                                 base.ToString(),
                                 m_FuelType.ToString()));
        }
예제 #2
0
        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()));
                }
            }
        }