Beispiel #1
0
        public bool FuelingVehicle(string i_LicenseNumber, eFuel i_Fual, int i_AmountToFaul)
        {
            if (!VehicleInGarage(i_LicenseNumber))
            {
                throw new ArgumentNullException("This Vehicle doesn't exist in the garage \n");
            }

            UserDetails currentUserDetails = m_GarageList[i_LicenseNumber];
            Vehicle     vehicleToFaul      = currentUserDetails.Vehicle;
            Engine      engineToFaul       = vehicleToFaul.VehicleEngine;
            FuelEngine  fuelEngine         = engineToFaul as FuelEngine;


            if (fuelEngine == null)
            {
                throw new ArgumentException("This is not fuel car \n");
            }

            eFuel correctFuel = fuelEngine.FuelType;

            if (!correctFuel.Equals(i_Fual))
            {
                throw new ArgumentException("You entered wrong fuel type");
            }

            bool tryToFuel = fuelEngine.Fill(i_AmountToFaul, i_Fual);

            return(tryToFuel);
        }
Beispiel #2
0
        public void FillFuel(string i_LicenseId, float i_amountOfFuel, eFuelType i_typeOfFuel)
        {
            FuelEngine eng = m_Vehicles[i_LicenseId].Vehicle.Engine as FuelEngine;

            eng.Fill(i_amountOfFuel, i_typeOfFuel);
        }