protected void Create(params string[] lines) { _vimHost = (MockVimHost)Vim.VimHost; _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer); _localSettings = _vimTextBuffer.LocalSettings; var foldManager = CreateFoldManager(_textView); _factory = new MockRepository(MockBehavior.Loose); _statusUtil = _factory.Create<IStatusUtil>(); _bulkOperations = new TestableBulkOperations(); var vimBufferData = CreateVimBufferData( _vimTextBuffer, _textView, statusUtil: _statusUtil.Object); _jumpList = vimBufferData.JumpList; _windowSettings = vimBufferData.WindowSettings; _vimData = Vim.VimData; _macroRecorder = Vim.MacroRecorder; _globalSettings = Vim.GlobalSettings; var operations = CreateCommonOperations(vimBufferData); _motionUtil = new MotionUtil(vimBufferData, operations); _commandUtil = new CommandUtil( vimBufferData, _motionUtil, operations, foldManager, new InsertUtil(vimBufferData, operations), _bulkOperations); }
public void SetUp() { _textView= new Mock<ITextView>(MockBehavior.Strict); _global = new Mock<IVimGlobalSettings>(MockBehavior.Strict); _localRaw = new LocalSettings(_global.Object, _textView.Object); _local = _localRaw; }
private void Create(ITextView textView, IEditorOptions editorOptions = null) { _textView = textView; _textBuffer = textView.TextBuffer; _snapshot = _textBuffer.CurrentSnapshot; _textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; }; _globalSettings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_globalSettings, FSharpOption.CreateForReference(editorOptions), FSharpOption.CreateForReference(textView)); _markMap = new MarkMap(new TrackingLineColumnService()); _vimData = new VimData(); _search = VimUtil.CreateSearchService(_globalSettings); _jumpList = VimUtil.CreateJumpList(); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); _navigator = VimUtil.CreateTextStructureNavigator(_textView, WordKind.NormalWord); _motionUtil = new MotionUtil( _textView, _markMap, _localSettings, _search, _navigator, _jumpList, _statusUtil.Object, VimUtil.GetWordUtil(textView), _vimData); }
private void Create(ITextView textView) { _textView = textView; _textBuffer = textView.TextBuffer; _buffer = _textView.TextBuffer; _snapshot = _buffer.CurrentSnapshot; _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; }; _globalSettings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_globalSettings, _textView); _markMap = new MarkMap(new TrackingLineColumnService()); _vimData = new VimData(); _search = VimUtil.CreateSearchService(_globalSettings); _jumpList = VimUtil.CreateJumpList(); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); _navigator = VimUtil.CreateTextStructureNavigator(_textView.TextBuffer); _motionUtil = new MotionUtil( _textView, _markMap, _localSettings, _search, _navigator, _jumpList, _statusUtil.Object, _vimData); }
public void Setup() { _synchronizer = new EditorToSettingSynchronizer(EditorUtil.FactoryService.Vim); _buffer = EditorUtil.FactoryService.Vim.CreateBuffer(EditorUtil.CreateTextView("")); _localSettings = _buffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _editorOptions = _localSettings.EditorOptions.Value; }
public EditorToSettingSynchronizerTest() { _synchronizer = new EditorToSettingSynchronizer(EditorOptionsFactoryService, Vim); _buffer = CreateVimBuffer(""); _localSettings = _buffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _editorOptions = _buffer.TextView.Options; }
public void Setup() { _synchronizer = new EditorToSettingSynchronizer(EditorUtil.FactoryService.EditorOptionsFactory, EditorUtil.FactoryService.Vim); var textView = EditorUtil.CreateTextView(""); _buffer = EditorUtil.FactoryService.Vim.CreateVimBuffer(textView); _localSettings = _buffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView); }
protected void Create(ModeArgument argument, params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _vimBuffer.SwitchMode(ModeKind.Insert, argument); _register = Vim.RegisterMap.GetRegister('c'); _globalSettings = Vim.GlobalSettings; _localSettings = _vimBuffer.LocalSettings; }
public void Create(ITextView textView) { _textView = textView; _buffer = _textView.TextBuffer; _snapshot = _buffer.CurrentSnapshot; _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; }; _settings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_settings, _textView); _utilRaw = new TextViewMotionUtil(_textView, _localSettings); _util = _utilRaw; }
/// <summary> /// Create the IVimBuffer with the given set of lines. Note that we intentionally don't /// set the mode to Insert here because the given commands should work irrespective of the /// mode /// </summary> /// <param name="lines"></param> private void Create(params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _globalSettings = _vimBuffer.GlobalSettings; _localSettings = _vimBuffer.LocalSettings; var operations = CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData); _insertUtilRaw = new InsertUtil(_vimBuffer.VimBufferData, operations); _insertUtil = _insertUtilRaw; }
public EditorToSettingSynchronizerTest() { _synchronizer = new EditorToSettingSynchronizer(); var textView = CreateTextView(); var globalSettings = new GlobalSettings(); _localSettings = new LocalSettings(globalSettings); _windowSettings = new WindowSettings(globalSettings); _editorOptions = textView.Options; _vimBuffer = new Mock<IVimBuffer>(MockBehavior.Strict); _vimBuffer.SetupGet(x => x.LocalSettings).Returns(_localSettings); _vimBuffer.SetupGet(x => x.WindowSettings).Returns(_windowSettings); _vimBuffer.SetupGet(x => x.TextView).Returns(textView); }
public void Create(ITextView textView) { _textView = textView; _buffer = _textView.TextBuffer; _snapshot = _buffer.CurrentSnapshot; _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; }; _settings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_settings, _textView); _markMap = new MarkMap(new TrackingLineColumnService()); _utilRaw = new TextViewMotionUtil( _textView, _markMap, _localSettings); _util = _utilRaw; }
public MotionCaptureTest() { _textView = CreateTextView(); var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); _incrementalSearch = new IncrementalSearch( vimBufferData, CommonOperationsFactory.GetCommonOperations(vimBufferData)); _localSettings = vimTextBuffer.LocalSettings; _captureRaw = new MotionCapture( vimBufferData, _incrementalSearch); _capture = _captureRaw; }
internal static ICommonOperations CreateCommonOperations( ITextView textView, IVimLocalSettings localSettings, IOutliningManager outlining = null, IStatusUtil statusUtil = null, ISearchService searchService = null, IUndoRedoOperations undoRedoOperations = null, IVimData vimData = null, IVimHost vimHost = null, ITextStructureNavigator navigator = null, IClipboardDevice clipboardDevice = null, IFoldManager foldManager = null) { var editorOperations = EditorUtil.GetOperations(textView); var editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView); var jumpList = new JumpList(new TrackingLineColumnService()); var keyMap = new KeyMap(); foldManager = foldManager ?? new FoldManager(textView.TextBuffer); statusUtil = statusUtil ?? new StatusUtil(); searchService = searchService ?? CreateSearchService(localSettings.GlobalSettings); undoRedoOperations = undoRedoOperations ?? new UndoRedoOperations(statusUtil, FSharpOption<ITextUndoHistory>.None); vimData = vimData ?? new VimData(); vimHost = vimHost ?? new MockVimHost(); navigator = navigator ?? CreateTextStructureNavigator(textView.TextBuffer); clipboardDevice = clipboardDevice ?? new MockClipboardDevice(); var operationsData = new OperationsData( editorOperations, editorOptions, foldManager, jumpList, keyMap, localSettings, outlining != null ? FSharpOption.Create(outlining) : FSharpOption<IOutliningManager>.None, CreateRegisterMap(clipboardDevice), searchService, EditorUtil.FactoryService.SmartIndentationService, statusUtil, textView, undoRedoOperations, vimData, vimHost, navigator); return new CommonOperations(operationsData); }
protected void Create(ITextView textView) { _textView = textView; _textBuffer = textView.TextBuffer; _snapshot = _textBuffer.CurrentSnapshot; _textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; }; _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); var vimBufferData = CreateVimBufferData(_vimTextBuffer, _textView, statusUtil: _statusUtil.Object); _globalSettings = vimBufferData.LocalSettings.GlobalSettings; _localSettings = vimBufferData.LocalSettings; _markMap = vimBufferData.Vim.MarkMap; _vimData = vimBufferData.Vim.VimData; _search = vimBufferData.Vim.SearchService; var wordNavigator = CreateTextStructureNavigator(_textView.TextBuffer, WordKind.NormalWord); _motionUtil = new MotionUtil(vimBufferData); }
protected virtual void Create(params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _vimBuffer.ErrorMessage += (_, message) => { if (_assertOnErrorMessage) { throw new Exception("Error Message: " + message.Message); } }; _vimBuffer.WarningMessage += (_, message) => { if (_assertOnWarningMessage) { throw new Exception("Warning Message: " + message.Message); } }; _vimBufferData = _vimBuffer.VimBufferData; _vimTextBuffer = _vimBuffer.VimTextBuffer; _normalMode = _vimBuffer.NormalMode; _keyMap = _vimBuffer.Vim.KeyMap; _localSettings = _vimBuffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _windowSettings = _vimBuffer.WindowSettings; _jumpList = _vimBuffer.JumpList; _vimHost = (MockVimHost)_vimBuffer.Vim.VimHost; _vimHost.BeepCount = 0; _vimData = Vim.VimData; _foldManager = FoldManagerFactory.GetFoldManager(_textView); _clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue<IClipboardDevice>(); // Many of the operations operate on both the visual and edit / text snapshot // simultaneously. Ensure that our setup code is producing a proper IElisionSnapshot // for the Visual portion so we can root out any bad mixing of instances between // the two Assert.True(_textView.VisualSnapshot is IElisionSnapshot); Assert.True(_textView.VisualSnapshot != _textView.TextSnapshot); }
protected void Create(params string[] lines) { _statusUtil = new TestableStatusUtil(); _vimData = Vim.VimData; _vimBufferData = CreateVimBufferData( CreateTextView(lines), statusUtil: _statusUtil); _vimBuffer = CreateVimBuffer(_vimBufferData); _vimTextBuffer = _vimBufferData.VimTextBuffer; _localSettings = _vimBufferData.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _textBuffer = _vimBufferData.TextBuffer; _textView = _vimBufferData.TextView; _interpreter = new global::Vim.Interpreter.Interpreter( _vimBuffer, CommonOperationsFactory.GetCommonOperations(_vimBufferData), FoldManagerFactory.GetFoldManager(_vimBufferData.TextView), new FileSystem(), BufferTrackingService); _keyMap = Vim.KeyMap; }
public LocalSettingsTest() { _global = new GlobalSettings(); _localRaw = new LocalSettings(_global); _local = _localRaw; }
public void Create(params string[] lines) { var tuple = EditorUtil.CreateTextViewAndEditorOperations(lines); _textView = tuple.Item1; _textBuffer = _textView.TextBuffer; var service = EditorUtil.FactoryService; _vimBuffer = service.Vim.CreateVimBuffer(_textView); _vimBuffer.ErrorMessage += (_, message) => { if (_assertOnErrorMessage) { Assert.Fail("Error Message: " + message); } }; _vimBuffer.WarningMessage += (_, message) => { if (_assertOnWarningMessage) { Assert.Fail("Warning Message: " + message); } }; _vimTextBuffer = _vimBuffer.VimTextBuffer; _keyMap = _vimBuffer.Vim.KeyMap; _localSettings = _vimBuffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _jumpList = _vimBuffer.JumpList; _vimHost = (MockVimHost)_vimBuffer.Vim.VimHost; _vimHost.BeepCount = 0; _vimData = service.Vim.VimData; _foldManager = EditorUtil.FactoryService.FoldManagerFactory.GetFoldManager(_textView); _clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue<IClipboardDevice>(); // Many of the operations operate on both the visual and edit / text snapshot // simultaneously. Ensure that our setup code is producing a proper IElisionSnapshot // for the Visual portion so we can root out any bad mixing of instances between // the two Assert.IsTrue(_textView.VisualSnapshot is IElisionSnapshot); Assert.IsTrue(_textView.VisualSnapshot != _textView.TextSnapshot); }
public void VimRcLoaded(VimRcState vimRcState, IVimLocalSettings localSettings, IVimWindowSettings windowSettings) { //throw new NotImplementedException(); }
public virtual void VimRcLoaded(VimRcState vimRcState, IVimLocalSettings localSettings, IVimWindowSettings windowSettings) { }
public void SetUp() { _textView = EditorUtil.CreateTextView(); _localSettings = new LocalSettings(new GlobalSettings(), EditorUtil.GetEditorOptions(_textView), _textView); _incrementalSearch = VimUtil.CreateIncrementalSearch(_textView, _localSettings, new VimData()); _factory = new MockRepository(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _captureRaw = new MotionCapture( _host.Object, _textView, _incrementalSearch, _localSettings); _capture = _captureRaw; }
/// <summary> /// Create a Mock over IVimTextBuffer which provides the msot basic functions /// </summary> public static Mock<IVimTextBuffer> CreateVimTextBuffer( ITextBuffer textBuffer, IVimLocalSettings localSettings = null, IVim vim = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); vim = vim ?? CreateVim(factory: factory).Object; localSettings = localSettings ?? CreateLocalSettings(factory: factory).Object; var mock = factory.Create<IVimTextBuffer>(); mock.SetupGet(x => x.TextBuffer).Returns(textBuffer); mock.SetupGet(x => x.LocalSettings).Returns(localSettings); mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupProperty(x => x.LastVisualSelection); return mock; }
/// <summary> /// Create the IVimBuffer with the given set of lines. Note that we intentionally don't /// set the mode to Insert here because the given commands should work irrespective of the /// mode /// </summary> /// <param name="lines"></param> private void Create(params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _buffer = EditorUtil.FactoryService.Vim.CreateVimBuffer(_textView); _globalSettings = _buffer.GlobalSettings; _localSettings = _buffer.LocalSettings; var operations = EditorUtil.FactoryService.CommonOperationsFactory.GetCommonOperations(_buffer.VimBufferData); _insertUtilRaw = new InsertUtil(_buffer.VimBufferData, operations); _insertUtil = _insertUtilRaw; }
public override FSharpOption <int> GetNewLineIndent(ITextView textView, ITextSnapshotLine contextLine, ITextSnapshotLine newLine, IVimLocalSettings localSettings) { if (_vimApplicationSettings.UseEditorIndent) { var indent = _smartIndentationService.GetDesiredIndentation(textView, newLine); if (indent.HasValue) { return(FSharpOption.Create(indent.Value)); } else { // If the user wanted editor indentation but the editor doesn't support indentation // even though it proffers an indentation service then fall back to what auto // indent would do if it were enabled (don't care if it actually is) // // Several editors like XAML offer the indentation service but don't actually // provide information. User clearly wants indent there since the editor indent // is enabled. Do a best effort and us Vim style indenting return(FSharpOption.Create(EditUtil.GetAutoIndent(contextLine, localSettings.TabStop))); } } return(FSharpOption <int> .None); }
internal OperationsImpl(ITextView view, IEditorOperations opts, IOutliningManager outlining, IVimHost host, IJumpList jumpList, IVimLocalSettings settings, IUndoRedoOperations undoRedoOpts) : base(view, opts, outlining, host, jumpList, settings, undoRedoOpts) { }
public void CreateCore(IMotionUtil motionUtil, params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _map = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice().Object); _unnamedRegister = _map.GetRegister(RegisterName.Unnamed); _factory = new MockRepository(MockBehavior.Strict); _editorOperations = _factory.Create<IEditorOperations>(MockBehavior.Loose); _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory); _jumpList = _factory.Create<IJumpList>(MockBehavior.Strict); _statusUtil = _factory.Create<IStatusUtil>(MockBehavior.Strict); _foldManager = _factory.Create<IFoldManager>(MockBehavior.Strict); _host = _factory.Create<IVimHost>(MockBehavior.Loose); _commandUtil = _factory.Create<ICommandUtil>(); _displayWindowBroker = _factory.Create<IDisplayWindowBroker>(MockBehavior.Strict); _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false); _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false); _displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false); _vimData = new VimData(); _globalSettings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_globalSettings, EditorUtil.GetEditorOptions(_textView), _textView); motionUtil = motionUtil ?? VimUtil.CreateTextViewMotionUtil( _textView, new MarkMap(new TrackingLineColumnService()), _localSettings); _buffer = MockObjectFactory.CreateVimBuffer( _textView, "test", MockObjectFactory.CreateVim(_map, host: _host.Object, vimData: _vimData).Object, _jumpList.Object, incrementalSearch: _incrementalSearch.Object, motionUtil: motionUtil, settings: _localSettings); _operations = _factory.Create<ICommonOperations>(MockBehavior.Strict); _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object); _operations.SetupGet(x => x.TextView).Returns(_textView); var capture = new MotionCapture( _host.Object, _textView, _incrementalSearch.Object, new LocalSettings(new GlobalSettings(), EditorUtil.GetEditorOptions(_textView), _textView)); var runner = new CommandRunner(_textView, _map, capture, _commandUtil.Object, _statusUtil.Object, VisualKind.Character); _modeRaw = new NormalMode( _buffer.Object, _operations.Object, _statusUtil.Object, _displayWindowBroker.Object, runner, capture); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); }
void IVimHost.VimRcLoaded(VimRcState vimRcState, IVimLocalSettings localSettings, IVimWindowSettings windowSettings) { VimRcState = vimRcState; }
private void Create(params string[] lines) { _vimHost = (MockVimHost)Vim.VimHost; _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer); _localSettings = _vimTextBuffer.LocalSettings; _foldManager = FoldManagerFactory.GetFoldManager(_textView); _factory = new MockRepository(MockBehavior.Loose); _statusUtil = _factory.Create<IStatusUtil>(); _smartIdentationService = _factory.Create<ISmartIndentationService>(); var vimBufferData = CreateVimBufferData( _vimTextBuffer, _textView, statusUtil: _statusUtil.Object); _jumpList = vimBufferData.JumpList; _windowSettings = vimBufferData.WindowSettings; _vimData = Vim.VimData; _macroRecorder = Vim.MacroRecorder; _registerMap = Vim.RegisterMap; _globalSettings = Vim.GlobalSettings; var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData); _motionUtil = new MotionUtil(vimBufferData); _commandUtil = new CommandUtil( vimBufferData, _motionUtil, operations, _smartIdentationService.Object, _foldManager, new InsertUtil(vimBufferData, operations)); }
public static Mock<IVimBuffer> CreateVimBuffer( ITextView textView, string name = null, IVim vim = null, IJumpList jumpList = null, IVimLocalSettings localSettings = null, IIncrementalSearch incrementalSearch = null, IMotionUtil motionUtil = null, ITextStructureNavigator wordNavigator = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); name = name ?? "test"; vim = vim ?? CreateVim().Object; jumpList = jumpList ?? (factory.Create<IJumpList>().Object); motionUtil = motionUtil ?? factory.Create<IMotionUtil>().Object; wordNavigator = wordNavigator ?? factory.Create<ITextStructureNavigator>().Object; localSettings = localSettings ?? new LocalSettings(vim.GlobalSettings); var vimTextBuffer = CreateVimTextBuffer( textView.TextBuffer, localSettings: localSettings, vim: vim, factory: factory); var mock = factory.Create<IVimBuffer>(); mock.SetupGet(x => x.TextView).Returns(textView); mock.SetupGet(x => x.MotionUtil).Returns(motionUtil); mock.SetupGet(x => x.TextBuffer).Returns(() => textView.TextBuffer); mock.SetupGet(x => x.TextSnapshot).Returns(() => textView.TextSnapshot); mock.SetupGet(x => x.Name).Returns(name); mock.SetupGet(x => x.LocalSettings).Returns(localSettings); mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings); mock.SetupGet(x => x.MarkMap).Returns(vim.MarkMap); mock.SetupGet(x => x.RegisterMap).Returns(vim.RegisterMap); mock.SetupGet(x => x.JumpList).Returns(jumpList); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupGet(x => x.VimData).Returns(vim.VimData); mock.SetupGet(x => x.IncrementalSearch).Returns(incrementalSearch); mock.SetupGet(x => x.WordNavigator).Returns(wordNavigator); mock.SetupGet(x => x.VimTextBuffer).Returns(vimTextBuffer.Object); return mock; }
public override void VimRcLoaded(VimRcState vimRcState, IVimLocalSettings localSettings, IVimWindowSettings windowSettings) { if (vimRcState.IsLoadFailed) { // If we failed to load a vimrc file then we should add a couple of sanity // settings. Otherwise the Visual Studio experience wont't be what users expect localSettings.AutoIndent = true; } }
/// <summary> /// Create a Mock over IVimTextBuffer which provides the msot basic functions /// </summary> public static Mock<IVimTextBuffer> CreateVimTextBuffer( ITextBuffer textBuffer, IVimLocalSettings localSettings = null, IVim vim = null, ITextStructureNavigator wordNavigator = null, IUndoRedoOperations undoRedoOperations = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); vim = vim ?? CreateVim(factory: factory).Object; localSettings = localSettings ?? CreateLocalSettings(factory: factory).Object; wordNavigator = wordNavigator ?? factory.Create<ITextStructureNavigator>().Object; undoRedoOperations = undoRedoOperations ?? factory.Create<IUndoRedoOperations>().Object; var mock = factory.Create<IVimTextBuffer>(); mock.SetupGet(x => x.TextBuffer).Returns(textBuffer); mock.SetupGet(x => x.LocalSettings).Returns(localSettings); mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupGet(x => x.WordNavigator).Returns(wordNavigator); mock.SetupGet(x => x.ModeKind).Returns(ModeKind.Normal); mock.SetupGet(x => x.UndoRedoOperations).Returns(undoRedoOperations); mock.SetupProperty(x => x.LastVisualSelection); mock.SetupProperty(x => x.LastInsertExitPoint); mock.SetupProperty(x => x.LastEditPoint); mock.Setup(x => x.SwitchMode(It.IsAny<ModeKind>(), It.IsAny<ModeArgument>())); return mock; }