/// <summary> /// Create a new instance /// </summary> public BankAppService(IBankAccountRepository bankAccountRepository, // the bank account repository dependency ICustomerRepository customerRepository, // the customer repository dependency IBankTransferService transferService, ILogger <BankAppService> logger) { //check preconditions if (bankAccountRepository == null) { throw new ArgumentNullException("bankAccountRepository"); } if (customerRepository == null) { throw new ArgumentNullException("customerRepository"); } if (transferService == null) { throw new ArgumentNullException("trasferService"); } _bankAccountRepository = bankAccountRepository; _customerRepository = customerRepository; _transferService = transferService; _logger = logger; _resources = LocalizationFactory.CreateLocalResources(); }
/// <summary> /// Create a new instance /// </summary> public BankAppService( IBankAccountRepository bankAccountRepository, // the bank account repository dependency ICustomerRepository customerRepository, // the customer repository dependency IBankTransferService transferService) { //check preconditions if (bankAccountRepository == null) { throw new ArgumentNullException("bankAccountRepository"); } if (customerRepository == null) { throw new ArgumentNullException("customerRepository"); } if (transferService == null) { throw new ArgumentNullException("trasferService"); } _bankAccountRepository = bankAccountRepository; _customerRepository = customerRepository; _transferService = transferService; }
public void ConstructorThrowExceptionIfBankTransferServiceDependencyIsNull() { //Arrange SICustomerRepository customerRepository = new SICustomerRepository(); SIBankAccountRepository bankAcccountRepository = new SIBankAccountRepository(); IBankTransferService transferService = null; //Act IBankAppService bankingService = new BankAppService(bankAcccountRepository, customerRepository, transferService); }
public void ConstructorThrowExceptionIfBankTransferServiceDependencyIsNull() { //Arrange var customerRepository = new Mock <ICustomerRepository>(); var bankAcccountRepository = new Mock <IBankAccountRepository>(); IBankTransferService transferService = null; Mock <ILogger <BankAppService> > _mockLogger = new Mock <ILogger <BankAppService> >(); Exception ex = Assert.Throws <ArgumentNullException>(() => { //Act IBankAppService bankingService = new BankAppService(bankAcccountRepository.Object, customerRepository.Object, transferService, _mockLogger.Object); } ); Assert.IsType(typeof(ArgumentNullException), ex); }
/// <summary> /// Create a new instance /// </summary> public BankAppService(IBankAccountRepository bankAccountRepository, // the bank account repository dependency ICustomerRepository customerRepository, // the customer repository dependency IBankTransferService transferService) { //check preconditions if (bankAccountRepository == null) throw new ArgumentNullException("bankAccountRepository"); if (customerRepository == null) throw new ArgumentNullException("customerRepository"); if (transferService == null) throw new ArgumentNullException("trasferService"); _bankAccountRepository = bankAccountRepository; _customerRepository = customerRepository; _transferService = transferService; }
// the entities - dto adapters /// <summary> /// Create a new instance /// </summary> public BankAppService(IBankAccountRepository bankAccountRepository, // the bank account repository dependency ICustomerRepository customerRepository, // the customer repository dependency IBankTransferService transferService, // bank transfer domain services ITypeAdapter adapter) { //check preconditions if (bankAccountRepository == null) throw new ArgumentNullException("bankAccountRepository"); if (customerRepository == null) throw new ArgumentNullException("customerRepository"); if (adapter == null) throw new ArgumentNullException("adapter"); if (transferService == null) throw new ArgumentNullException("trasferService"); _bankAccountRepository = bankAccountRepository; _customerRepository = customerRepository; _adapter = adapter; _transferService = transferService; }
public TransferController(IMapper mapper, IBankTransferService bankTransferService, IBankAccountService bankAccountService) { _mapper = mapper; _bankTransferService = bankTransferService; _bankAccountService = bankAccountService; }
public BankTransfersController(IBankTransferService bankTransferService) { this.bankTransferService = bankTransferService; }