コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }