public void Convert_ValidateAmountInDinars_Successful() { var dolar = new DolarCurrency(1.01); var amount = manager.Convert(dolar, 50); var expectedAmount = 50 * 1.01; Assert.AreEqual(expectedAmount, amount); }
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); } }