public void TestCreateElisionBufferWithoutIndentation() { var exportProvider = TestExportProvider.ExportProviderWithCSharpAndVisualBasic; var contentTypeRegistryService = exportProvider.GetExportedValue <IContentTypeRegistryService>(); var textBuffer = exportProvider.GetExportedValue <ITextBufferFactoryService>().CreateTextBuffer( @" line 1 line 2 line 3", contentTypeRegistryService.GetContentType("text")); var elisionBuffer = IProjectionBufferFactoryServiceExtensions.CreateElisionBufferWithoutIndentation( exportProvider.GetExportedValue <IProjectionBufferFactoryService>(), exportProvider.GetExportedValue <IEditorOptionsFactoryService>().GlobalOptions, textBuffer.CurrentSnapshot.GetFullSpan()); var elisionSnapshot = elisionBuffer.CurrentSnapshot; Assert.Equal(elisionSnapshot.LineCount, 3); foreach (var line in elisionSnapshot.Lines) { Assert.True(line.GetText().StartsWith("line", StringComparison.Ordinal)); } }
public void TestCreateProjectionBuffer() { var composition = EditorTestCompositions.EditorFeatures; var exportProvider = composition.ExportProviderFactory.CreateExportProvider(); var contentTypeRegistryService = exportProvider.GetExportedValue <IContentTypeRegistryService>(); var textBuffer = exportProvider .GetExportedValue <ITextBufferFactoryService>() .CreateTextBuffer( @" line 1 line 2 line 3 line 4", contentTypeRegistryService.GetContentType("text") ); var projectionBuffer = IProjectionBufferFactoryServiceExtensions.CreateProjectionBuffer( exportProvider.GetExportedValue <IProjectionBufferFactoryService>(), exportProvider.GetExportedValue <IContentTypeRegistryService>(), exportProvider.GetExportedValue <IEditorOptionsFactoryService>().GlobalOptions, textBuffer.CurrentSnapshot, "...", LineSpan.FromBounds(1, 2), LineSpan.FromBounds(3, 4) ); var projectionSnapshot = projectionBuffer.CurrentSnapshot; Assert.Equal(4, projectionSnapshot.LineCount); var lines = projectionSnapshot.Lines.ToList(); Assert.Equal("...", lines[0].GetText()); Assert.Equal(" line 2", lines[1].GetText()); Assert.Equal("...", lines[2].GetText()); Assert.Equal(" line 4", lines[3].GetText()); }