예제 #1
0
        public void PaymentCard_Credit_ShouldRemoveFundsFromBalance_WhenCredited(int creditAmount)
        {
            var startingBalance = 1000;
            var card            = new PaymentCard(startingBalance);

            Assert.Equal(startingBalance, card.Balance);

            card.Credit(creditAmount);
            var newBalance = startingBalance - creditAmount;

            Assert.Equal(newBalance, card.Balance);
        }
예제 #2
0
        public void PaymentCard_Credit_ShouldThrowException_WhenCardDoesNotHaveSufficientFunds()
        {
            var card = new PaymentCard();

            Assert.Throws <Exception>(() => card.Credit(10));
        }