// ReSharper disable InconsistentNaming
        public void Undo_Expected_Positive()
// ReSharper restore InconsistentNaming
        {
            ActionManager actManager = new ActionManager();
            actManager.RecordAction(_mockAction.Object);
            actManager.Undo();
            Assert.IsTrue(actManager.CanRedo);
        }
 public TransactionBase(ActionManager am)
     : this()
 {
     ActionManager = am;
     if(am != null)
     {
         am.OpenTransaction(this);
     }
 }
示例#3
0
        public DataMappingViewModel(IWebActivity activity, NotifyCollectionChangedEventHandler mappingCollectionChangedEventHandler = null)
        {
            _activity = activity;
            _actionManager = new ActionManager();
            Inputs = new ObservableCollection<IInputOutputViewModel>();
            Outputs = new ObservableCollection<IInputOutputViewModel>();

            if(mappingCollectionChangedEventHandler != null)
            {
                Inputs.CollectionChanged += mappingCollectionChangedEventHandler;
                Outputs.CollectionChanged += mappingCollectionChangedEventHandler;
            }
            Initialize(_activity);
        }
 public TransactionBase(ActionManager am, bool isDelayed)
     : this(am)
 {
     IsDelayed = isDelayed;
 }
        public void Two_Actions_One_Undo_Expected_CanUndo_true()
        {
            ActionManager actManager = new ActionManager();
            actManager.RecordAction(_mockAction.Object);
            actManager.RecordAction(_mockAction.Object);
            actManager.Undo();

            Assert.IsTrue(actManager.CanUndo && actManager.CanRedo);
        }
// ReSharper disable InconsistentNaming
        public void RecordAction_ExecutingAction_Expected_No_Action()
// ReSharper restore InconsistentNaming
        {
            ActionManager actManager = new ActionManager { ExecuteImmediatelyWithoutRecording = true };
            actManager.RecordAction(_mockAction.Object);

            Assert.IsTrue(!actManager.CanUndo && !actManager.CanRedo);
        }
// ReSharper disable InconsistentNaming
        public void RecordAction_Null_Action_Expected_No_Action()
// ReSharper restore InconsistentNaming
        {
            ActionManager actManager = new ActionManager();
            actManager.RecordAction(null);
            Assert.IsTrue(!actManager.CanUndo && !actManager.CanRedo);
        }