public void NotApplyBonusFunds() { var customer = new Customer("John Moore", false); var startingFunds = CustomerBenefits.CalculateOpeningAccountBalance(customer, 100); Assert.AreEqual(100, startingFunds); }
public void Apply500BonusFundsWhenWhenAPreferedCustomerOpensAnAccount() { var customer = new Customer("John Moore", true); var startingFunds = CustomerBenefits.CalculateOpeningAccountBalance(customer, 100); Assert.AreEqual(600, startingFunds); }
public async Task Handle(CreateAccount command) { this.log.Information($"Handling create command for customer {command.CustomerId}"); var customer = await customerRepository.Find(command.CustomerId); if (customer == null) { throw new CustomerNotFoundException(command.CustomerId); } var startingBalance = CustomerBenefits.CalculateOpeningAccountBalance(customer, command.StartingBalance); var newAccount = BankAccount.CreateAccount(command.CustomerId, startingBalance); await bankAccountRepository.AddOrUpdate(newAccount); this.log.Information($"Account {newAccount.Id} created for {command.CustomerId}"); }