示例#1
0
        public static void Run()
        {
            AtmMachine atm = new AtmMachine(1000);

            Console.WriteLine("Testing state with right pin");

            atm.InsertCard();
            atm.EnterPinCode(123);
            atm.RequestCash(600);
            atm.EjectCard();

            //Wrong pin
            Console.WriteLine("Testing state with wrong pin");
            atm.InsertCard();
            atm.EnterPinCode(890);
            atm.RequestCash(600);
            atm.EjectCard();



        }
 public HasCardState(AtmMachine context) : base(context)
 {
 }
 public AtmMachineState(AtmMachine context)
 {
     _context = context;
 }
 public HasPinState(AtmMachine context) : base(context)
 {
 }
 public AtmMachineProxy()
 {
     _machine = new AtmMachine(1000);
 }
 public NoCashState(AtmMachine context) : base(context)
 {
 }