Example #1
0
        public void Withdraw_ShouldThrowException_WhenGivenNegativeAmount()
        {
            int negativeAmount = -10;

            var account = new Sut();

            Assert.Throws <ArgumentException>(() => account.Withdraw(negativeAmount));
        }
Example #2
0
        public void Withdraw_ShouldThrowInvalidOperationException_WhenGivenAmount_GreaterThanTheBalance()
        {
            int amountGreaterThatBalance = 20;
            int balance = 10;

            var sut = new Sut(balance);

            Assert.Throws <InvalidOperationException>(() => sut.Withdraw(amountGreaterThatBalance));
        }
Example #3
0
        public void Withdraw_ShouldReduceBalance_WithTheGivenAmount()
        {
            int withdrawAmount = 10;
            int balance        = 20;

            var account = new Sut(balance);

            account.Withdraw(withdrawAmount);

            Assert.AreEqual(balance - withdrawAmount, account.Balance);
        }