public void Setup()
        {
            //Setup mock dependencies.
            var companyRepoMock = new Mock <ICompanyRepository>();

            companyRepoMock.Setup(c => c.GetById(1)).Returns(VERY_IMPORTANT_COMPANY);
            companyRepoMock.Setup(c => c.GetById(2)).Returns(NOT_IMPORTANT_COMPANY);
            _companyRepository = companyRepoMock.Object;

            var customerDataAccessMock = new Mock <ICustomerDataAccessStrategy>();

            _customerDataAccess = customerDataAccessMock.Object;
        }
        public static bool AddCustomer(ICompanyRepository companyRepo, ICustomerDataAccessStrategy customerDataAccess,
                                       string firname, string surname, string email, DateTime dateOfBirth, int companyId)
        {
            Company company = companyRepo.GetById(companyId);

            try {
                var customer = new Customer(company, dateOfBirth, email, firname, surname);
                customer.CreditCheck();
                if (customer.HasCreditLimit && customer.CreditLimit < 500)
                {
                    return(false);
                }

                CustomerDataAccess.AddCustomer(customer, customerDataAccess);
                return(true);
            } catch (Exception ex) {
                // Customer related validation handled in Customer constructor, throws exception if any parameters
                // Are invalid.
                return(false);
            }
        }
 public static void AddCustomer(Customer customer, ICustomerDataAccessStrategy dataAccess)
 {
     dataAccess.AddCustomer(customer);
 }