public void InsertDebitCard() { atmMachineState.InsertDebitCard(); // Debit csrd has been inserted so internal state of ATM Machine // Has been changed to 'DebitCardNotInserted' if (atmMachineState is DebitCardNotInsertedState) { atmMachineState = new DebitCardInsertedState(); Console.WriteLine($"ATM machine internal state has been moved to : {atmMachineState.GetType().Name}"); } }
public void EjectDebitCard() { atmMachineState.EjectDebitCard(); // Debit Card has been ejected so internal state of ATM Machine // has been changed to 'DebitCardNotInsertedState' if (atmMachineState is DebitCardInsertedState) { atmMachineState = new DebitCardNotInsertedState(); Console.WriteLine("ATM Machine internal state has been moved to : " + atmMachineState.GetType().Name); } }