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); }
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); }