Ejemplo n.º 1
0
 public Doubler()
 {
     ExpectedResult  = GetNewRandomNumber();
     CurrentNumber   = new OperationTarget(0);
     OperationsStack = new Stack <IOperationInterface> {
     };
 }
Ejemplo n.º 2
0
        public bool RevertOperation()
        {
            if (OperationsStack.Count == 0)
            {
                return(false);
            }

            IOperationInterface Operation = OperationsStack.Pop();

            CurrentNumber = Operation.Revert();

            return(true);
        }
Ejemplo n.º 3
0
 private void ExecuteOperation(IOperationInterface operation)
 {
     CurrentNumber = operation.Execute();
     OperationsStack.Push(operation);
 }
Ejemplo n.º 4
0
 public void ResetCurrentNumberAndOperationStack()
 {
     CurrentNumber = new OperationTarget(0);
     OperationsStack.Clear();
 }