public IVirtualCashCard GetByCardNumber(string cardNumber)
        {
            IVirtualCashCard result = null;

            cardList.TryGetValue(cardNumber, out result);
            return(result);
        }
Ejemplo n.º 2
0
        public void VirtualCardShouldReturnFalseAfterWrongPin()
        {
            double initialBalance = 10;
            string pin            = "1234";

            IVirtualCashCard card = VirtualCashCard.createCard("Card1", pin, initialBalance);

            (var result, var balance) = card.Withdraw("8888", 10);
            Assert.IsFalse(result);
        }
Ejemplo n.º 3
0
        public void VirtualCardShouldChangeBalanceAfterPopup()
        {
            double initialBalance  = 10;
            double expectedBalance = 20;
            string pin             = "1234";

            IVirtualCashCard card = VirtualCashCard.createCard("Card1", pin, initialBalance);

            (var result, var balance) = card.PopUp(10);
            Assert.AreEqual(expectedBalance, balance);
        }
Ejemplo n.º 4
0
        public void VirtualCardShouldChangeBalanceAfterWithDraw()
        {
            double initialBalance  = 10;
            double expectedBalance = 0;
            string pin             = "1234";

            IVirtualCashCard card = VirtualCashCard.createCard("Card1", pin, initialBalance);

            (var result, var balance) = card.Withdraw(pin, 10);
            Assert.IsTrue(result);
            Assert.AreEqual(expectedBalance, balance);
        }
 public bool Add(string cardNumber, IVirtualCashCard virtualCashCard)
 {
     return(cardList.TryAdd(cardNumber, virtualCashCard));;
 }