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

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

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

            bankAccount.Withdraw(300);
            Assert.That(bankAccount.Amount, Is.LessThan(2700));
        }
예제 #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));
            });
        }
예제 #5
0
        public void TestBankAccountIsInstanceOf()
        {
            var bankAccount = new BankAcount(3000);

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

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