public IVirtualCashCard GetByCardNumber(string cardNumber) { IVirtualCashCard result = null; cardList.TryGetValue(cardNumber, out result); return(result); }
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); }
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); }
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));; }