public void ApplyShouldInsertChar(int position) { state.CurrentPosition = position; command = new InsertCharCommand('1'); var result = command.Apply(state); result.Should().BeTrue(); state.Text[position].Should().Be('1'); state.CurrentPosition.Should().Be(position + 1); }
public void RevertShouldRestoreState(int position) { state.CurrentPosition = position; command = new InsertCharCommand('1'); var oldState = new ControllerState(state); var applyResult = command.Apply(state); applyResult.Should().BeTrue(); var result = command.Revert(state); result.Should().BeTrue(); state.Should().Be(oldState); }