Exemple #1
0
        public void TestBankAccountWithdrawInRange()
        {
            var bankAccount = new BankAcount(3000);

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.InRange(2700 - 2700 * 0.5m, 2700));
        }
Exemple #2
0
        public void TestBankAccountWithdrawIsNotNaN()
        {
            var bankAccount = new BankAcount(3000);

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.Not.NaN);
        }
Exemple #3
0
        public void TestBankAccountWithdrawLessThan()
        {
            var bankAccount = new BankAcount(3000);

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.LessThan(2700));
        }
Exemple #4
0
        public void TestBankAccountWithdraw()
        {
            decimal initialAmount = 3000;
            var     bankAccount   = new BankAcount(initialAmount);

            Assert.Multiple(() =>
            {
                decimal withdrawAmount        = 300;
                decimal expectedLefOverAmount = initialAmount - withdrawAmount - withdrawAmount * 0.05m;
                bankAccount.Withdraw(withdrawAmount);
                Assert.That(bankAccount.Amount, Is.EqualTo(expectedLefOverAmount));

                withdrawAmount        = 1500;
                expectedLefOverAmount = bankAccount.Amount - withdrawAmount - withdrawAmount * 0.02m;
                bankAccount.Withdraw(withdrawAmount);
                Assert.That(bankAccount.Amount, Is.EqualTo(expectedLefOverAmount));
            });
        }
Exemple #5
0
        public void TestBankAccountIsInstanceOf()
        {
            var bankAccount = new BankAcount(3000);

            Assert.That(bankAccount, Is.InstanceOf <BankAcount>());
        }
Exemple #6
0
        public void TestBankAccountInstantiation()
        {
            var bankAccount = new BankAcount(3000);

            Assert.That(bankAccount, Is.Not.Null);
        }
Exemple #7
0
 public void TestBankAccountInstantiationException()
 {
     Assert.That(() => { BankAcount bankAccount = new BankAcount(-100); }, Throws.TypeOf <ArgumentException>());
 }