public CarConfiguration(IRaceTrack raceTrack, double fuelCapacity, TimeSpan timePerLap, double fuelConsumptionPerLap) { _raceTrack = (RaceTrack)raceTrack; _fuelCapacity = fuelCapacity; _timePerLap = timePerLap; _fuelConsumptionPerLap = fuelConsumptionPerLap; _configurationId = Guid.NewGuid(); }
public RaceCar(ICarConfiguration carConfiguration) { _carConfiguration = carConfiguration; _raceTrack = ((CarConfiguration)carConfiguration).RaceTrack; _raceCarId = Guid.NewGuid(); _fuelLevel = _carConfiguration.FuelCapacity; _speed = _raceTrack.LapDistrance / _carConfiguration.TimePerLap.TotalSeconds; }