Ejemplo n.º 1
0
 public CommandMarginProviderTest()
 {
     _factory                  = new MockRepository(MockBehavior.Strict);
     _vim                      = _factory.Create <IVim>();
     _clipboardDevice          = (TestableClipboardDevice)CompositionContainer.GetExportedValue <IClipboardDevice>();
     _commandMarginProviderRaw = new CommandMarginProvider(
         _vim.Object,
         VimEditorHost.EditorFormatMapService,
         VimEditorHost.ClassificationFormatMapService,
         CommonOperationsFactory,
         _clipboardDevice);
     _commandMarginProvider = _commandMarginProviderRaw;
 }
Ejemplo n.º 2
0
        public CommandMarginControllerIntegrationTest()
        {
            _vimBuffer       = CreateVimBuffer();
            _clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue <IClipboardDevice>();

            var parentElement = new FrameworkElement();

            _control    = new CommandMarginControl();
            _controller = new CommandMarginController(
                _vimBuffer,
                parentElement,
                _control,
                VimEditorHost.EditorFormatMapService.GetEditorFormatMap(_vimBuffer.TextView),
                VimEditorHost.ClassificationFormatMapService.GetClassificationFormatMap(_vimBuffer.TextView),
                CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData),
                _clipboardDevice);
        }
Ejemplo n.º 3
0
        protected CommandMarginControllerTest()
        {
            _factory       = new MockRepository(MockBehavior.Strict);
            _marginControl = new CommandMarginControl();
            _marginControl.CommandLineTextBox.Text = string.Empty;

            _search = _factory.Create <IIncrementalSearch>();
            _search.SetupGet(x => x.HasActiveSession).Returns(false);
            _search.SetupGet(x => x.InPasteWait).Returns(false);
            _vimBuffer = new MockVimBuffer
            {
                IncrementalSearchImpl = _search.Object,
                VimImpl         = MockObjectFactory.CreateVim(factory: _factory).Object,
                CommandModeImpl = _factory.Create <ICommandMode>(MockBehavior.Loose).Object
            };
            var textBuffer = CreateTextBuffer(new[] { "" });

            _vimBuffer.TextViewImpl = TextEditorFactoryService.CreateTextView(textBuffer);

            var vimBufferData = CreateVimBufferData(_vimBuffer.TextView);

            _globalSettings = new Mock <IVimGlobalSettings>();
            _vimBuffer.GlobalSettingsImpl = _globalSettings.Object;

            var editorFormatMap = _factory.Create <IEditorFormatMap>(MockBehavior.Loose);

            editorFormatMap.Setup(x => x.GetProperties(It.IsAny <string>())).Returns(new ResourceDictionary());

            var parentVisualElement = _factory.Create <FrameworkElement>();

            _clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue <IClipboardDevice>();

            _controller = new CommandMarginController(
                _vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                VimEditorHost.EditorFormatMapService.GetEditorFormatMap(_vimBuffer.TextView),
                VimEditorHost.ClassificationFormatMapService.GetClassificationFormatMap(_vimBuffer.TextView),
                CommonOperationsFactory.GetCommonOperations(vimBufferData),
                _clipboardDevice,
                false);
        }
        protected virtual void Create(params string[] lines)
        {
            _factory       = new MockRepository(MockBehavior.Strict);
            _marginControl = new CommandMarginControl();
            _marginControl.CommandLineTextBox.Text = string.Empty;
            _vimBuffer       = CreateVimBuffer(lines);
            _textBuffer      = _vimBuffer.TextBuffer;
            _textView        = _vimBuffer.TextView;
            _keyboardDevice  = new MockKeyboardDevice();
            _clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue <IClipboardDevice>();

            var parentVisualElement = _factory.Create <FrameworkElement>();

            _controller = new CommandMarginController(
                _vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                VimEditorHost.EditorFormatMapService.GetEditorFormatMap(_vimBuffer.TextView),
                VimEditorHost.ClassificationFormatMapService.GetClassificationFormatMap(_vimBuffer.TextView),
                CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData),
                _clipboardDevice);
        }