Ejemplo n.º 1
0
        protected CommandMarginControllerTest()
        {
            _factory       = new MockRepository(MockBehavior.Strict);
            _marginControl = new CommandMarginControl();
            _marginControl.CommandLineTextBox.Text = String.Empty;

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

            _vimBuffer.TextViewImpl = TextEditorFactoryService.CreateTextView(textBuffer);

            Mock <IVimGlobalSettings> 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>();

            _controller = new CommandMarginController(
                _vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                VimEditorHost.EditorFormatMapService.GetEditorFormatMap(_vimBuffer.TextView),
                VimEditorHost.ClassificationFormatMapService.GetClassificationFormatMap(_vimBuffer.TextView));
        }
        protected virtual void Create(params string[] lines)
        {
            _factory                  = new MockRepository(MockBehavior.Strict);
            _marginControl            = new CommandMarginControl();
            _marginControl.StatusLine = String.Empty;
            _vimBuffer                = CreateVimBuffer(lines);
            _textBuffer               = _vimBuffer.TextBuffer;
            _textView                 = _vimBuffer.TextView;
            _keyboardDevice           = new MockKeyboardDevice();

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

            editorFormatMap.Setup(x => x.GetProperties(It.IsAny <string>())).Returns(new ResourceDictionary());
            var fontProperties = MockObjectFactory.CreateFontProperties("Courier New", 10, _factory);

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

            _controller = new CommandMarginController(
                _vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                editorFormatMap.Object,
                fontProperties.Object,
                new List <Lazy <IOptionsProviderFactory> >());
        }
Ejemplo n.º 3
0
        public CommandMarginControllerTest()
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _search  = _factory.Create <IIncrementalSearch>();
            _search.SetupGet(x => x.InSearch).Returns(false);
            _vimBuffer = new MockVimBuffer();
            _vimBuffer.IncrementalSearchImpl = _search.Object;
            _vimBuffer.VimImpl         = MockObjectFactory.CreateVim(factory: _factory).Object;
            _vimBuffer.CommandModeImpl = _factory.Create <ICommandMode>(MockBehavior.Loose).Object;
            _marginControl             = new CommandMarginControl();
            _marginControl.StatusLine  = String.Empty;

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

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

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

            _controller = new CommandMarginController(
                _vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                editorFormatMap.Object,
                new List <Lazy <IOptionsProviderFactory> >());
        }
Ejemplo n.º 4
0
 public void Setup()
 {
     _factory = new MockRepository(MockBehavior.Strict);
     _search  = _factory.Create <IIncrementalSearch>();
     _buffer  = new MockVimBuffer();
     _buffer.IncrementalSearchImpl = _search.Object;
     _buffer.VimImpl           = MockObjectFactory.CreateVim(factory: _factory).Object;
     _marginControl            = new CommandMarginControl();
     _marginControl.StatusLine = String.Empty;
     _controller = new CommandMarginController(
         _buffer,
         _marginControl,
         new List <Lazy <IOptionsProviderFactory> >());
 }
        public CommandMarginControllerIntegrationTest()
        {
            _vimBuffer = CreateVimBuffer();

            var parentElement = new FrameworkElement();

            _control    = new CommandMarginControl();
            _controller = new CommandMarginController(
                _vimBuffer,
                parentElement,
                _control,
                VimEditorHost.EditorFormatMapService.GetEditorFormatMap(_vimBuffer.TextView),
                VimEditorHost.ClassificationFormatMapService.GetClassificationFormatMap(_vimBuffer.TextView));
        }
Ejemplo n.º 6
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.º 7
0
        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();

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

            _controller = new CommandMarginController(
                _vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                VimEditorHost.EditorFormatMapService.GetEditorFormatMap(_vimBuffer.TextView),
                VimEditorHost.ClassificationFormatMapService.GetClassificationFormatMap(_vimBuffer.TextView));
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        protected CommandMarginControllerTest()
        {
            _factory                  = new MockRepository(MockBehavior.Strict);
            _marginControl            = new CommandMarginControl();
            _marginControl.StatusLine = String.Empty;

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

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

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

            _controller = new CommandMarginController(
                vimBuffer,
                parentVisualElement.Object,
                _marginControl,
                editorFormatMap.Object,
                new List <Lazy <IOptionsProviderFactory> >());
        }
Ejemplo n.º 10
0
        public CommandMarginControllerTest()
        {
            _factory = new MockRepository(MockBehavior.Strict);
            _search = _factory.Create<IIncrementalSearch>();
            _search.SetupGet(x => x.InSearch).Returns(false);
            _vimBuffer = new MockVimBuffer();
            _vimBuffer.IncrementalSearchImpl = _search.Object;
            _vimBuffer.VimImpl = MockObjectFactory.CreateVim(factory: _factory).Object;
            _marginControl = new CommandMarginControl();
            _marginControl.StatusLine = String.Empty;

            var editorFormatMap = _factory.Create<IEditorFormatMap>(MockBehavior.Loose);
            editorFormatMap.Setup(x => x.GetProperties(It.IsAny<string>())).Returns(new ResourceDictionary());

            _controller = new CommandMarginController(
                _vimBuffer,
                _marginControl,
                editorFormatMap.Object,
                new List<Lazy<IOptionsProviderFactory>>());
        }
Ejemplo n.º 11
0
        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,
                isFirstCommandMargin: false);
        }
Ejemplo n.º 12
0
 public void Setup()
 {
     _factory = new MockRepository(MockBehavior.Strict);
     _search = _factory.Create<IIncrementalSearch>();
     _buffer = new MockVimBuffer();
     _buffer.IncrementalSearchImpl = _search.Object;
     _buffer.VimImpl = MockObjectFactory.CreateVim(factory: _factory).Object;
     _marginControl = new CommandMarginControl();
     _marginControl.StatusLine = String.Empty;
     _controller = new CommandMarginController(
         _buffer,
         _marginControl,
         new List<Lazy<IOptionsProviderFactory>>());
 }
 public void Setup()
 {
     _buffer = new MockVimBuffer();
     _marginControl = new CommandMarginControl();
     _marginControl.StatusLine = String.Empty;
     _controller = new CommandMarginController(
         _buffer,
         _marginControl,
         new List<Lazy<IOptionsProviderFactory>>());
 }