Example #1
0
 public void InsertCard(int cardNumber)
 {
     if (cardNumber < currentBalances.Length) // card exists in db
     {
         Console.WriteLine("Card {0} successfully inserted!", cardNumber);
         machine.SetState(new CardInsertedState(machine, currentBalances, cardNumber));
     }
     else
     {
         throw new Exception("Card invalid, try again later or contact your provider");
     }
 }
Example #2
0
 public void EjectCard()
 {
     Console.WriteLine("Card successfully ejected");
     machine.SetState(new IdleState(machine, currentBalances));
 }