protected FallbackKeyProcessorTest(bool useVimBuffer = false) { _keyboardDevice = new MockKeyboardDevice(); _commands = new Mock <Commands>(MockBehavior.Strict); _dte = new Mock <_DTE>(MockBehavior.Loose); _dte.SetupGet(x => x.Commands).Returns(_commands.Object); _removedBindingList = new List <CommandKeyBinding>(); _vimApplicationSettings = new Mock <IVimApplicationSettings>(MockBehavior.Loose); _vimApplicationSettings .SetupGet(x => x.RemovedBindings) .Returns(() => _removedBindingList.AsReadOnly()); var textView = CreateTextView(""); _vimBuffer = useVimBuffer ? Vim.GetOrCreateVimBuffer(textView) : null; _keyProcessor = new FallbackKeyProcessor( _dte.Object, CompositionContainer.GetExportedValue <IKeyUtil>(), _vimApplicationSettings.Object, textView, _vimBuffer, new ScopeData()); }
private IVimBuffer CreateVimBuffer() { var factory = CompositionContainer.GetExport <ITextEditorFactoryService>().Value; var textView = factory.CreateTextView(); // Verify we actually created the IVimBuffer instance var vimBuffer = Vim.GetOrCreateVimBuffer(textView); Assert.NotNull(vimBuffer); // Do one round of DoEvents since several services queue up actions to // take immediately after the IVimBuffer is created for (var i = 0; i < 10; i++) { Dispatcher.CurrentDispatcher.DoEvents(); } return(vimBuffer); }