public string From(Customer customer) { string firstName = RemoveUnderScoreFrom(customer.FirstName); string lastName = RemoveUnderScoreFrom(customer.LastName); return string.Format("{0} {1}", customer.FirstName, customer.LastName); }
/// <summary> /// We need to verify that save is called /// </summary> /// <param name="customercommand"></param> public void Create(CustomerCreateCommand customercommand) { Customer customer = new Customer(customercommand.FirstName, customercommand.LastName); customer.FullName = _fullNameFactory.From(customercommand.FirstName, customercommand.LastName); _customerRepository.Save(customer); }
/// <summary> /// Create a customer with assigned workstation... /// </summary> /// <param name="createCommand"></param> public void CreateAssignedWorkStation(CustomerCreateCommand createCommand) { var customer = new Customer(createCommand.FirstName, createCommand.LastName); // We need to verify that this property is get from workstation Id... customer.WorkStationId = _applicationSettings.WorkStationId; _customerRepository.Save(customer); }
public void Create(CustomerCreateCommand createCommand) { var customer = new Customer(createCommand.FirstName, createCommand.LastName); // We need to verify that this property is set... _customerRepository.TimeZone = TimeZone.CurrentTimeZone.StandardName; _customerRepository.Save(customer); }
public void Create(CustomerCreateCommand customercommand) { Customer customer = new Customer(customercommand.FirstName, customercommand.LastName); ICustomerAddressBuilder customerAddressBuilder = _mailingAddressFactory.GetAddressBuilder(true); // we need to verify that from is called in customer address builder... customer.MailingAddress = customerAddressBuilder.From(customercommand); _customerRepository.Save(customer); }
/// <summary> /// We need to verify that save is called /// </summary> /// <param name="customercommand"></param> public void Create(IEnumerable<CustomerCreateCommand> customercommandsList) { foreach (var customercommand in customercommandsList) { Customer customer = new Customer(customercommand.FirstName, customercommand.LastName); // We need different Ids from create method... customer.Id = _idFactory.Create(); _customerRepository.Save(customer); } }
public void Create(CustomerCreateCommand customercommand) { Customer customer = new Customer(customercommand.FirstName, customercommand.LastName); customer.MailingAddress = _customerAddressBuilder.From(customercommand); if (customer.MailingAddress == null) { throw new InvalidCustomerMailingAddressException(); } _customerRepository.Save(customer); }
public void Create(CustomerCreateCommand createCommand) { var customer = new Customer(createCommand.FirstName, createCommand.LastName); customer.Status = _statusFactory.From(createCommand); if (customer.Status == CustomerStatusEnum.Platinum) { _customerRepository.SaveSpecial(customer); } else { _customerRepository.Save(customer); } }
/// <summary> /// We need to verify that save is called /// </summary> /// <param name="customercommand"></param> public void Create(CustomerCreateCommand customercommand) { Customer customer = new Customer(customercommand.FirstName, customercommand.LastName); customer.MailingAddress = customercommand.MailingAddress; MailingAddress mailingAddress; // We need to mock the output parameter to continue testing... bool mailingAddressSuccessfullyCreated = _mailingAddressFactory.TryParse(customer.MailingAddress, out mailingAddress); if (!mailingAddressSuccessfullyCreated) { throw new InvalidCustomerMailingAddressException(); } customer.DetailedMailingAddress = mailingAddress; _customerRepository.Save(customer); }
/// <summary> /// Create a customer with assigned workstation... /// </summary> /// <param name="createCommand"></param> public void CreateComplexAssignedWorkStation(CustomerCreateCommand createCommand) { var customer = new Customer(createCommand.FirstName, createCommand.LastName); // We need to verify that this property is get from workstation Id in application settings... int? workstationId = _applicationSettings .SystemConfiguration .AuditingInformation .WorkStationId; if (!workstationId.HasValue) { throw new InvalidWorkStationIdException(); } customer.WorkStationId = workstationId.Value; _customerRepository.Save(customer); }
public void Create(CustomerCreateCommand customercommand) { Customer customer = new Customer(customercommand.FirstName, customercommand.LastName); _customerRepository.Save(customer); }