protected override void Context() { base.Context(); _commandToReset = A.Fake <IReversibleCommand <IOSPSuiteExecutionContext> >(); _inverseCommand = A.Fake <IReversibleCommand <IOSPSuiteExecutionContext> >(); A.CallTo(() => _commandToReset.InverseCommand(_executionContext)).Returns(_inverseCommand); }
protected override void Because() { _removePartialStabiCommand.RestoreExecutionData(_executionContext); _restorePartialStabiCommand = _removePartialStabiCommand.InverseCommand(_executionContext); _restorePartialStabiCommand.Execute(_executionContext); }
protected override void Because() { _removePartialStabiCommand.RestoreExecutionData(_executionContext); _restorePartialStabiCommand = _removePartialStabiCommand.InverseCommand(_executionContext).DowncastTo <IReversibleCommand <IExecutionContext> >(); _restorePartialStabiCommand.Execute(_executionContext); }
//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); }
public static IReversibleCommand <IOSPSuiteExecutionContext> InvokeInverse(this IReversibleCommand <IOSPSuiteExecutionContext> command, IOSPSuiteExecutionContext context) { command.RestoreExecutionData(context); var inverse = command.InverseCommand(context); inverse.Execute(context); return(inverse); }
protected override void Context() { base.Context(); sut.Execute(_executionContext); sut.RestoreExecutionData(_executionContext); _inverseCommand = sut.InverseCommand(_executionContext).DowncastTo <IReversibleCommand <IExecutionContext> >(); _inverseCommand.Execute(_executionContext); _inverseCommand.RestoreExecutionData(_executionContext); _redoCommand = _inverseCommand.InverseCommand(_executionContext).DowncastTo <IReversibleCommand <IExecutionContext> >(); }
protected override void Context() { base.Context(); sut.Execute(_executionContext); sut.RestoreExecutionData(_executionContext); _inverseCommand = sut.InverseCommand(_executionContext); _inverseCommand.Execute(_executionContext); _inverseCommand.RestoreExecutionData(_executionContext); _redoCommand = _inverseCommand.InverseCommand(_executionContext); }
protected override void Context() { _state = 2; _inverseCommand1 = A.Fake <IReversibleCommand <MyContext> >(); _inverseCommand2 = A.Fake <IReversibleCommand <MyContext> >(); _command1 = A.Fake <IReversibleCommand <MyContext> >(); _command2 = A.Fake <IReversibleCommand <MyContext> >(); _commandList = new List <IReversibleCommand <MyContext> > { _command1, _command2 }; sut = new RollBackCommand <MyContext>(_state, _commandList); _context = new MyContext(); A.CallTo(() => _command1.InverseCommand(_context)).Returns(_inverseCommand1); A.CallTo(() => _command2.InverseCommand(_context)).Returns(_inverseCommand2); }
public void should_retreive_the_inverse_command_of_the_command_defined_as_parameter() { A.CallTo(() => _commandToReset.InverseCommand(_executionContext)).MustHaveHappened(); }