コード例 #1
0
        public CustomersBusinessComponent(ICustomersRepository customersRepository,
                                          ICustomerNameValidation customerNameValidation,
                                          ICustomerValidation customerValidation)
        {
            if (customersRepository == default(ICustomersRepository))
            {
                throw new ArgumentException(INVALID_CUSTOMERS_REPOSITORY, "customersRepository");
            }

            this.customersRepository = customersRepository;

            if (customerNameValidation == default(ICustomerNameValidation))
            {
                throw new ArgumentException(INVALID_ARGUMENTS, "customerNameValidation");
            }

            this.customerNameValidation = customerNameValidation;

            if (customerValidation == default(ICustomerValidation))
            {
                throw new ArgumentException(INVALID_ARGUMENTS, "customerValidation");
            }

            this.customerValidation = customerValidation;
        }
コード例 #2
0
 public CustomerController()
 {
     _customerName    = new CustomerNameValidator();
     _consoleHelper   = new ConsoleHelper();
     _customerAddress = new CustomerAddressValidator();
     _customerCity    = new CustomerCityValidator();
     _customerState   = new CustomerStateValidator();
     _customerZip     = new CustomerZipValidator();
     _customerPhone   = new CustomerPhoneValidator();
 }
コード例 #3
0
 public CustomerController(ICustomerNameValidation nameValidator,
                           IConsoleHelper consoleHelper,
                           ICustomerAddressValidation addressValidator,
                           ICustomerCityValidation cityValidator,
                           ICustomerStateValidation stateValidator,
                           ICustomerZipValidation zipValidator,
                           ICustomerPhoneValidation phoneValidator)
 {
     _customerName    = nameValidator;
     _consoleHelper   = consoleHelper;
     _customerAddress = addressValidator;
     _customerCity    = cityValidator;
     _customerState   = stateValidator;
     _customerZip     = zipValidator;
     _customerPhone   = phoneValidator;
 }