Beispiel #1
0
        public MementoToken Deposit(int amount)
        {
            _balance += amount;
            var m = new MementoToken(_balance);

            _changes.Add(m);
            _current++;
            return(m);
        }
Beispiel #2
0
 public MementoToken Restore(MementoToken token)
 {
     if (token != null)
     {
         _balance = token.Balance;
         _changes.Add(token);
         return(token);
     }
     return(null);
 }