public CarService(string name, ConsumptionAtSpeed lowSpeedConsumption, ConsumptionAtSpeed highSpeedConsumption, double maxSpeed) { Name = name; LowSpeedConsumption = lowSpeedConsumption; HighSpeedConsumption = highSpeedConsumption; MaxSpeed = maxSpeed; }
public ICar Create(string name, ConsumptionAtSpeed lowSpeedConsumption, ConsumptionAtSpeed highSpeedConsumption, double maxSpeed) { lowSpeedConsumption.AssertNotNull(); highSpeedConsumption.AssertNotNull(); maxSpeed.AssertPositive(); maxSpeed.AssertLargerThan(0); var Car = new CarService(name, lowSpeedConsumption, highSpeedConsumption, maxSpeed); return Car; }