//By being able to pass in the model this way, you can use your Unit Tests to pass in a Fake or Moq because the Controller no //longer uses a concrete instance of the model, but rather it uses the one that we give it //In this way, you're strictly testing the Controller and not any of its dependencies public ProteinTrackerController(IProteinTrackingService proteinModel) { //we're saying that this class depends on a ProteinTrackingService - I mean, something has to pass that in to this constructor //otherwise it won't get initialized and used, right? _proteinModel = proteinModel; _proteinModel.Total = 0; }
public ProteinTrackerController(IProteinTrackingService proteinTrackingService) { _proteinTrackingService = proteinTrackingService; }
public ProteinTrackerController(IProteinTrackingService proteinTrackingService) { this._proteinTrackingService = proteinTrackingService; }
public HomeController(IProteinTrackingService _proteinTrackingService) { this._proteinTrackingService = _proteinTrackingService; }
public ProteinTrackerController(IProteinTrackingService service) { this.proteinTrackingService = service; }