public void PayInstallmentFailInvalid(float a) { Account credit_card = new Account(); credit_card.Grant(a); Assert.That(() => credit_card.PayInstallment(), Throws.TypeOf <InvalidInstallmentException>()); }
public void PayInstallmentFailNoFunds([Values(1, 10)] float a, [Values(900, 1000)] float b) { Account credit_card = new Account(); credit_card.Deposit(a); credit_card.Grant(1000); credit_card.WithdrawFromCreditCard(b); Assert.That(() => credit_card.PayInstallment(), Throws.TypeOf <NotEnoughFundsException>()); }
[TestCase(1000F, 1000 - 870F, 500F - 133.9F)] //ON public void PayInstallment(float a, float b, float c) { //arrange Account credit_card = new Account(); credit_card.Deposit(500F); credit_card.Grant(1000F); //act credit_card.WithdrawFromCreditCard(a); //WithdrawFromCreditCard nu-i totuna cu Withdraw -> vezi comentariile din clasa Account credit_card.PayInstallment(); //assert Assert.AreEqual(b, credit_card.CreditBalance); Assert.AreEqual(c, credit_card.Balance); }