Exemplo n.º 1
0
            public AdornmentManagerTester()
            {
                _subjectBuffer = EditorFactory.CreateBuffer(TestExportProvider.ExportProviderWithCSharpAndVisualBasic, "Hi There");

                _textView = new Mock <IWpfTextView>();
                var aggregatorService = new Mock <IViewTagAggregatorFactoryService>();

                _adornmentLayer = new Mock <IAdornmentLayer>();
                _aggregator     = new Mock <ITagAggregator <Tag> >();

                var layerName = "LayerName";

                _textView.Setup(tv => tv.GetAdornmentLayer(layerName)).Returns(_adornmentLayer.Object);
                _textView.SetupGet(tv => tv.VisualElement).Returns(new FrameworkElement());

                aggregatorService.Setup(a => a.CreateTagAggregator <Tag>(_textView.Object)).Returns(_aggregator.Object);

                var textViewModel = new Mock <ITextViewModel>();

                textViewModel.Setup(tvm => tvm.VisualBuffer).Returns(_subjectBuffer);
                _textView.Setup(tv => tv.TextViewModel).Returns(textViewModel.Object);

                var workspace = new TestWorkspace();

                Manager = AdornmentManager <Tag> .Create(
                    workspace.ExportProvider.GetExportedValue <IThreadingContext>(),
                    _textView.Object,
                    aggregatorService.Object,
                    AsynchronousOperationListenerProvider.NullListener,
                    adornmentLayerName : layerName);
            }
Exemplo n.º 2
0
            public AdornmentManagerTester()
            {
                _subjectBuffer = EditorFactory.CreateBuffer(TestExportProvider.ExportProviderWithCSharpAndVisualBasic, "Hi There");

                _textView = new Mock <IWpfTextView>();
                var aggregatorService = new Mock <IViewTagAggregatorFactoryService>();

                _adornmentLayer = new Mock <IAdornmentLayer>();
                _aggregator     = new Mock <ITagAggregator <Tag> >();

                var layerName = "LayerName";

                _textView.Setup(tv => tv.GetAdornmentLayer(layerName)).Returns(_adornmentLayer.Object);
                _textView.SetupGet(tv => tv.VisualElement).Returns(new FrameworkElement());

                aggregatorService.Setup(a => a.CreateTagAggregator <Tag>(_textView.Object)).Returns(_aggregator.Object);

                var textViewModel = new Mock <ITextViewModel>();

                textViewModel.Setup(tvm => tvm.VisualBuffer).Returns(_subjectBuffer);
                _textView.Setup(tv => tv.TextViewModel).Returns(textViewModel.Object);

                var workspace = new TestWorkspace();

                var listener = new AggregateAsynchronousOperationListener(
                    Enumerable.Empty <Lazy <IAsynchronousOperationListener, FeatureMetadata> >(),
                    FeatureAttribute.LineSeparators);

                Manager = AdornmentManager <Tag> .Create(_textView.Object,
                                                         aggregatorService.Object,
                                                         listener,
                                                         adornmentLayerName : layerName);
            }