public void CreateEmptyBaseAccountTest() { CustomerPersonalData cust = new CustomerPersonalData("John", "Smith", 35); Account acc = new Account(1, AccountBenefitsType.Base, cust); Assert.That(acc.ID == 1 && acc.BenefitsType == AccountBenefitsType.Base); }
public void Update(CustomerPersonalData customer) { if (customer == null) { throw new ArgumentNullException(nameof(customer)); } _customerRepository.Update(customer); _uow.Commit(); }
public void AddSomeAmountToBaseAccountTest() { CustomerPersonalData cust = new CustomerPersonalData("John", "Smith", 35); Account acc = new Account(1, AccountBenefitsType.Base, cust); decimal amount = 1000m; acc.Add(amount); ////TODO check if there is an existing NUnit method which wraps decimals comparisons Assert.That(decimal.Compare(acc.Balance, 1000m) == 0, $"{_balanceMismatchMsg} {amount}"); }
public void Bonuses_AddAmountToBaseAccount_CheckBonusesTest() { CustomerPersonalData cust = new CustomerPersonalData("John", "Smith", 35); Account acc = new Account(1, AccountBenefitsType.Base, cust); decimal amount = 1000m; acc.Add(amount); int expectedAccumulatedBonuses = 700; Assert.That(acc.AccumulatedBonuses, Is.EqualTo(expectedAccumulatedBonuses), $"{_accumulatedBonusesMismatchMsg}, expected: {expectedAccumulatedBonuses}, actual: {acc.AccumulatedBonuses}"); }
public void WithdrawSomeAmountFromBaseAccountTest() { CustomerPersonalData cust = new CustomerPersonalData("John", "Smith", 35); Account acc = new Account(1, AccountBenefitsType.Base, cust); decimal initialAmount = 1000m; acc.Add(initialAmount); decimal withdrawAmount = 600m; acc.Withdraw(withdrawAmount); decimal expectedAmount = 400m; ////TODO check if there is an existing NUnit method which wraps decimals comparisons Assert.That(decimal.Compare(acc.Balance, expectedAmount) == 0, $"{_balanceMismatchMsg} {expectedAmount}"); }