Exemplo n.º 1
0
        public void TestBankAccountWithdrawIsNotNaN()
        {
            var bankAccount = new BankAcount(3000);

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.Not.NaN);
        }
Exemplo n.º 2
0
        public void TestBankAccountWithdrawLessThan()
        {
            var bankAccount = new BankAcount(3000);

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.LessThan(2700));
        }
Exemplo n.º 3
0
        public void TestBankAccountWithdrawInRange()
        {
            var bankAccount = new BankAcount(3000);

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.InRange(2700 - 2700 * 0.5m, 2700));
        }
Exemplo n.º 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));
            });
        }