public virtual Transfer MakeTransfer(string counterAccount, Money amount) { // 1. Assuming result is 9-digit bank account number, validate 11-test: int sum = 0; // <1> for (int i = 0; i < counterAccount.Length; i++) { sum = sum + (9 - i) * (int)Char. GetNumericValue(counterAccount[i]); } if (sum % 11 == 0) { // 2. Look up counter account and make transfer object: CheckingAccount acct = Accounts.FindAcctByNumber(counterAccount); Transfer result = new Transfer(this, acct, amount); // <2> return(result); } else { throw new BusinessException("Invalid account number!"); } }
public Transfer(Account acct1, CheckingAccount acct2, Money m) { CounterAccount = acct2; }
public void Init() { myAccount = Accounts.MakeAccount<SavingsAccount>("123456789"); registeredCounterAccount = Accounts.MakeAccount<CheckingAccount>("497164833"); myAccount.RegisteredCounterAccount = registeredCounterAccount; }
public void Init() { myAccount = Accounts.MakeAccount <CheckingAccount>("123456789"); counterAccount = Accounts.MakeAccount <CheckingAccount>("497164833"); }
public void Init() { myAccount = Accounts.MakeAccount<CheckingAccount>("123456789"); counterAccount = Accounts.MakeAccount<CheckingAccount>("497164833"); }
public Transfer(Account acct1, CheckingAccount acct2, Money m) { CounterAccount = acct2; }
public Transfer(Account acct1, CheckingAccount acct2, Money m) { }
public void TestNoCounterAccount() { CheckingAccount unRegisteredCounterAccount = Accounts.MakeAccount <CheckingAccount>("1439"); myAccount.MakeTransfer(Accounts.GetAccountNumber(unRegisteredCounterAccount), new Money()); }
public void Init() { myAccount = Accounts.MakeAccount <SavingsAccount>("123456789"); registeredCounterAccount = Accounts.MakeAccount <CheckingAccount>("497164833"); myAccount.RegisteredCounterAccount = registeredCounterAccount; }