public void CreditPayment_ValidateCreditDebt_Successful() { var account = manager.GetAccountById(new Guid("00000000-0000-0000-0000-300000000001")); manager.CreditPayment(new Guid("00000000-0000-0000-0000-300000000001"), 200); var expectedAmount = 300; Assert.AreEqual(expectedAmount, account.CreditDebt); }
public void AddFunds(IClient client, Guid accountID, double amount, ICurrency currency) { if (client == null) { throw new ArgumentNullException(); } if (currency == null) { throw new ArgumentNullException(); } List <IAccount> accounts = client.ListOfAccounts; amount = financeManager.Convert(currency, amount); if (client is PravnoLice && amount < 10000) { throw new Exception("Amount has to be greater than 10000."); } var clientAccount = client.ListOfAccounts.FirstOrDefault(x => x.ID == accountID); if (clientAccount == null) { throw new KeyNotFoundException("Account not found in clients database."); } var dbAccount = financeManager.GetAccountByID(accountID); if (dbAccount == null) { throw new KeyNotFoundException("Account not found in database."); } if (clientAccount.CreditAvailable) { financeManager.CreditPayment(accountID, amount); emailSender.SendEmail(client.Email, "Rata uspesno placena.", "Rata za kredit uspesno placena.\nIznos koji je uplacen je: " + amount); } else { financeManager.AccountPayment(accountID, amount); emailSender.SendEmail(client.Email, "Uplata uspesna.", "Uspesno uplacen novac na racun.\nIznos koji je uplacen je: " + amount); } }