private void Create(params string[] lines) { _textView = CreateTextView(lines); _factory = new MockRepository(MockBehavior.Strict); _vimHost = _factory.Create <IVimHost>(); var registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _keyMap = _factory.Create <IKeyMap>(); _globalSettings = _factory.Create <IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.WrapScan).Returns(false); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); // Initialize the Mock<IVim> with all of our Mock'd services var vim = MockObjectFactory.CreateVim( registerMap: registerMap.Object, host: _vimHost.Object, keyMap: _keyMap.Object, searchService: _searchService, settings: _globalSettings.Object, vimData: new VimData()); _localSettings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _vimTextBuffer = MockObjectFactory.CreateVimTextBuffer( _textView.TextBuffer, localSettings: _localSettings.Object, vim: vim.Object, factory: _factory); // Initialize the VimBufferData with all of our Mock'd services _jumpList = _factory.Create <IJumpList>(); _statusUtil = _factory.Create <IStatusUtil>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var vimBufferData = CreateVimBufferData( _vimTextBuffer.Object, _textView, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, undoRedoOperations: _undoRedoOperations); _outlining = _factory.Create <IOutliningManager>(); _editorOperations = _factory.Create <IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); var commonOperations = new CommonOperations( vimBufferData, _editorOperations.Object, FSharpOption.Create(_outlining.Object), SmartIndentationService); _operationsRaw = new DefaultOperations( vimBufferData, commonOperations); _operations = _operationsRaw; }
private void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _factory = new MockRepository(MockBehavior.Strict); _editOpts = _factory.Create <IEditorOperations>(); _editOpts.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editOpts.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _host = _factory.Create <IVimHost>(); _jumpList = _factory.Create <IJumpList>(); _registerMap = MockObjectFactory.CreateRegisterMap(factory: _factory); _globalSettings = _factory.Create <IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(global: _globalSettings.Object); _keyMap = _factory.Create <IKeyMap>(); _statusUtil = _factory.Create <IStatusUtil>(); _outlining = _factory.Create <IOutliningManager>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); var data = new OperationsData( vimData: new VimData(), vimHost: _host.Object, textView: _textView, editorOperations: _editOpts.Object, outliningManager: FSharpOption.Create(_outlining.Object), statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, keyMap: _keyMap.Object, undoRedoOperations: _undoRedoOperations, editorOptions: null, navigator: null, foldManager: null, registerMap: _registerMap.Object, searchService: _searchService); _operationsRaw = new DefaultOperations(data); _operations = _operationsRaw; }
public void Create(params string[] lines) { _textView = CreateTextView(lines); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); // Create the Vim instance with our Mock'd services _vimData = new VimData(); var registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _vimHost = _factory.Create <IVimHost>(); _globalSettings = _factory.Create <IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.IsVirtualEditOneMore).Returns(false); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorSettings).Returns(false); _globalSettings.SetupGet(x => x.VirtualEdit).Returns(String.Empty); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); var vim = MockObjectFactory.CreateVim( registerMap: registerMap, host: _vimHost.Object, settings: _globalSettings.Object, searchService: _searchService, factory: _factory); // Create the IVimTextBuffer instance with our Mock'd services _localSettings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _localSettings.SetupGet(x => x.AutoIndent).Returns(false); _localSettings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _localSettings.SetupGet(x => x.ExpandTab).Returns(true); _localSettings.SetupGet(x => x.TabStop).Returns(4); var vimTextBuffer = MockObjectFactory.CreateVimTextBuffer( _textBuffer, localSettings: _localSettings.Object, vim: vim.Object, factory: _factory); // Create the VimBufferData instance with our Mock'd services _jumpList = _factory.Create <IJumpList>(); _statusUtil = _factory.Create <IStatusUtil>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var vimBufferData = CreateVimBufferData( vimTextBuffer.Object, _textView, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, undoRedoOperations: _undoRedoOperations); _smartIndentationService = _factory.Create <ISmartIndentationService>(); _outlining = _factory.Create <IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny <SnapshotSpan>(), It.IsAny <Predicate <ICollapsed> >())) .Returns <IEnumerable <ICollapsible> >(null); _operationsRaw = new CommonOperations( vimBufferData, EditorOperationsFactoryService.GetEditorOperations(_textView), FSharpOption.Create(_outlining.Object), _smartIndentationService.Object); _operations = _operationsRaw; }