예제 #1
0
        //1    2    3         4
        //  C1   C2   C31 C32    roll back to 1
        protected override void Context()
        {
            _context      = new MyContext();
            _historyItems = new List <IHistoryItem>();
            _command0     = new MyReversibleCommand {
                InternalId = "_command0"
            };
            _command1 = new MyReversibleCommand {
                InternalId = "_command1"
            };
            _command2 = new MyReversibleCommand {
                InternalId = "_command2"
            };
            _command31 = new MyReversibleCommand {
                InternalId = "_command31"
            };
            _command32 = new MyReversibleCommand {
                InternalId = "_command32"
            };
            _inverseCommand32 = _command32.InverseCommand(_context);
            _inverseCommand31 = _command31.InverseCommand(_context);
            _inverseCommand2  = _command2.InverseCommand(_context);
            _exceptionManager = A.Fake <IExceptionManager>();
            _eventPublisher   = A.Fake <IEventPublisher>();

            sut = new HistoryManager <MyContext>(_context, _eventPublisher, _exceptionManager, new HistoryItemFactory(), new RollBackCommandFactory(), _historyItems);

            sut.AddToHistory(_command0);
            sut.AddToHistory(_command1);
            sut.AddToHistory(_command2);
            _command3 = new MacroCommand <MyContext>();
            _command3.Add(_command31);
            _command3.Add(_command32);
            sut.AddToHistory(_command3);
        }
 protected override void Because()
 {
     _commandToAdd1 = A.Fake <ICommand <MyContext> >();
     _commandToAdd2 = A.Fake <ICommand <MyContext> >();
     _commandToAdd3 = A.Fake <ICommand <MyContext> >();
     _macroCommand.Add(_commandToAdd1, _commandToAdd2, _commandToAdd3);
 }