private ICarOperation GetOperation(string opName) { if (Container.IsRegistered <ICarOperation>(opName)) { ICarOperation op = Container.Resolve <ICarOperation>(opName); return(op); } else { throw new InvalidOperationException(); } }
public CarController(ICarOperation operation) { _operation = operation; }
public CarController() { _operation = new CarOperation(); }
public void Execute(ICar car) { ICarOperation op = GetOperation(car.Command.ToString()); op.DoOperation(car); }