Exemple #1
0
        private void Create(params string[] lines)
        {
            _textBuffer = CreateTextBuffer(lines);
            _textView   = MockObjectFactory.CreateTextView(_textBuffer);
            _textView.SetupGet(x => x.HasAggregateFocus).Returns(true);

            // Setup normal mode so that we can provide an ICommandRunner to
            // recieve commands from
            _factory = new MockRepository(MockBehavior.Loose)
            {
                DefaultValue = DefaultValue.Mock
            };
            _runner     = _factory.Create <ICommandRunner>(MockBehavior.Loose);
            _normalMode = _factory.Create <INormalMode>(MockBehavior.Strict);
            _normalMode.SetupGet(x => x.CommandRunner).Returns(_runner.Object);

            // Create the IVimBuffer instance
            _buffer = _factory.Create <IVimBuffer>(MockBehavior.Loose);
            _buffer.DefaultValue = DefaultValue.Mock;
            _buffer.SetupGet(x => x.NormalMode).Returns(_normalMode.Object);

            _vimData = VimUtil.CreateVimData();
            var vim = MockObjectFactory.CreateVim(vimData: _vimData);

            _tracker = new ChangeTracker(vim.Object);
            _tracker.OnVimBufferCreated(_buffer.Object);
        }