Base:
1 override of ToString
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Extensions.SnapshotSourceText.cs (1)
176public override string ToString()
665 references to ToString
IdeCoreBenchmarks (1)
ClassificationBenchmarks.cs (1)
110var text = document.GetTextAsync().Result.ToString();
Microsoft.CodeAnalysis (3)
Syntax\SyntaxDiffer.cs (1)
45return new[] { new TextChange(new TextSpan(0, 0), after.GetText().ToString()) };
Syntax\SyntaxTree.cs (1)
402return this.GetText(CancellationToken.None).ToString();
Syntax\SyntaxTreeExtensions.cs (1)
73var allText = text.ToString(); // Entire document as string to allow inspecting the text in the debugger.
Microsoft.CodeAnalysis.CodeStyle (2)
AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (1)
182return SyntaxFacts.GetNameOfMemberAccessExpression(memberAccess).GetText().ToString();
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
73var allText = text.ToString(); // Entire document as string to allow inspecting the text in the debugger.
Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities (4)
AbstractCodeActionOrUserDiagnosticTest.cs (4)
700VerifyExpectedDocumentText(expectedRoot.ToString(), root.ToString()); 706var actualString = root.ToString(); 716VerifyExpectedDocumentText(expectedRoot.ToString(), actualString);
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (1)
CodeFixVerifierHelper.cs (1)
100return text?.ToString();
Microsoft.CodeAnalysis.CSharp (2)
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (1)
109public override string ToString() => BoundNode.Syntax.GetText().ToString();
Parser\LanguageParser.cs (1)
227builder.Add(SyntaxFactory.BadToken(null, lexer.TextWindow.Text.ToString(), null));
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
2436Assert.Equal(expectedEmbeddedMap[docPath], embeddedSource.ToString());
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
ConvertNamespace\ConvertNamespaceCommandHandler.cs (1)
93edit.Replace(new Span(0, args.SubjectBuffer.CurrentSnapshot.Length), convertedText.ToString());
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (48)
ChangeSignature\RemoveParametersTests.cs (4)
260Assert.Contains("void Ext(this C5 c, string s)", (await updatedDocument.GetTextAsync(CancellationToken.None)).ToString()); 264Assert.Contains(@"c.Ext(""two"");", (await updatedDocument.GetTextAsync(CancellationToken.None)).ToString()); 342Assert.Contains("void Ext(this C5 c, string s, int newIntegerParameter)", (await updatedDocument.GetTextAsync(CancellationToken.None)).ToString()); 346Assert.Contains(@"c.Ext(""two"", 123);", (await updatedDocument.GetTextAsync(CancellationToken.None)).ToString());
CodeActions\EnableNullable\EnableNullableTests.cs (2)
30if (!Regex.IsMatch(document.GetTextSynchronously(CancellationToken.None).ToString(), "#nullable ?enable")) 46if (!Regex.IsMatch(document.GetTextSynchronously(CancellationToken.None).ToString(), "#nullable ?restore"))
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (1)
940Assert.Equal(expectedCode, formattedText.ToString());
CodeActions\Preview\PreviewTests.cs (1)
124var text = diffView.Viewer.RightView.TextBuffer.AsTextContainer().CurrentText.ToString();
CodeActions\SyncNamespace\CSharpSyncNamespaceTestsBase.cs (4)
188var actualText = (await modifiedOriginalDocument.GetTextAsync()).ToString(); 196var oldRefText = (await oldSolution.GetDocument(refDocumentId).GetTextAsync()).ToString(); 197var newRefText = (await newSolution.GetDocument(refDocumentId).GetTextAsync()).ToString(); 204var actualRefText = (await newSolution.GetDocument(refDocumentId).GetTextAsync()).ToString();
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (4)
2495var actualCodeAfterCommit = textView.TextBuffer.CurrentSnapshot.AsText().ToString(); 2752var actualCodeAfterCommit = textView.TextBuffer.CurrentSnapshot.AsText().ToString(); 2808var actualCodeAfterCommit = textView.TextBuffer.CurrentSnapshot.AsText().ToString(); 3287var actualCodeAfterCommit = textBuffer.CurrentSnapshot.AsText().ToString();
DecompiledSource\DecompiledSourceFormattingTests.cs (1)
234AssertEx.Equal(expected, test.ToString());
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (5)
69Assert.Equal(updatedEditorConfig, result?.ToString()); 78Assert.Equal(updatedEditorConfig, result?.ToString()); 414var fileText = newText.ToString(); 422fileText = newText.ToString(); 432fileText = newText.ToString();
ExtractInterface\ExtractInterfaceTests.cs (5)
510var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString(); 550var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString(); 591var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString(); 902var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString(); 1059var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString();
Formatting\CodeCleanupTests.cs (2)
762Assert.Equal(expected, actual.ToString()); 847Assert.Equal(expected, actual.ToString());
Formatting\RazorLineFormattingOptionsTests.cs (1)
81", formattedText.ToString());
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (2)
118AssertEx.EqualOrDiff(expected, actual.ToString()); 277File.WriteAllText(sourceCodePaths[i], sources[i].ToString(), sources[i].Encoding);
PdbSourceDocument\PdbSourceDocumentTests.cs (3)
789AssertEx.EqualOrDiff(source, actualText.ToString()); 818AssertEx.EqualOrDiff(source, actualText.ToString()); 847AssertEx.EqualOrDiff(source, actualText.ToString());
SplitStringLiteral\SplitStringLiteralCommandHandlerTests.cs (1)
106Assert.Equal(expectedOutput, textBuffer.CurrentSnapshot.AsText().ToString());
StringIndentation\StringIndentationTests.cs (1)
63return changedText.ToString();
Workspaces\WorkspaceTests_EditorFeatures.cs (11)
499Assert.Equal("public class X { }", docZText.ToString()); 549var hasX = (await doc1Z.GetTextAsync()).ToString().Contains("X"); 609var hasX = (await doc1Z.GetTextAsync()).ToString().Contains("X"); 670Assert.Equal(startText, (await workspace.CurrentSolution.GetDocument(document.Id).GetTextAsync()).ToString()); 677Assert.Equal(startText, (await workspace.CurrentSolution.GetDocument(document.Id).GetTextAsync()).ToString()); 1005Assert.Equal("some text", (await additionalDocument.GetTextAsync()).ToString()); 1029Assert.Equal("root = true", (await analyzerConfigDocument.GetTextAsync()).ToString()); 1359Assert.Equal(originalText, (await eventArgs[0].OldSolution.GetDocument(originalDocumentId).GetTextAsync().ConfigureAwait(false)).ToString()); 1360Assert.Equal(originalText, (await eventArgs[1].OldSolution.GetDocument(originalDocumentId).GetTextAsync().ConfigureAwait(false)).ToString()); 1362Assert.Equal(updatedText, (await eventArgs[0].NewSolution.GetDocument(originalDocumentId).GetTextAsync().ConfigureAwait(false)).ToString()); 1363Assert.Equal(updatedText, (await eventArgs[1].NewSolution.GetDocument(originalDocumentId).GetTextAsync().ConfigureAwait(false)).ToString());
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenTupleTest.cs (1)
22652Assert.Equal(newText.ToString(), finalText);
PDB\PDBEmbeddedSourceTests.cs (1)
130Assert.Equal(source, embeddedSource.Text.ToString());
Microsoft.CodeAnalysis.CSharp.Features (4)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
198var newTextChangeText = formattedText.GetSubText(new TextSpan(newRange.Span.Start + amountToShift, newRange.NewLength)).ToString();
SplitStringLiteral\SimpleStringSplitter.cs (3)
48var prefix = Document.Text.GetSubText(TextSpan.FromBounds(_token.SpanStart, CursorPosition)).ToString(); 49var suffix = Document.Text.GetSubText(TextSpan.FromBounds(CursorPosition, _token.Span.End)).ToString(); 54? Document.Text.GetSubText(TextSpan.FromBounds(_token.Span.End - "u8".Length, _token.Span.End)).ToString()
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
ScriptTests.cs (1)
64Assert.Equal(state.Script.Code, compilation.SyntaxTrees.First().GetText().ToString());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (14)
Semantics\LocalFunctionTests.cs (12)
7262var localFuncPosition = tree.GetText().ToString().IndexOf("void local<TParameter>()", StringComparison.Ordinal) - 1; 7263var methodPosition = tree.GetText().ToString().IndexOf("void M2<TParameter>()", StringComparison.Ordinal) - 1; 7415var localFuncPosition = tree.GetText().ToString().IndexOf("[My(a)]", StringComparison.Ordinal); 7416var methodPosition = tree.GetText().ToString().IndexOf("[My(b)]", StringComparison.Ordinal); 7489var localFuncPosition = tree.GetText().ToString().IndexOf("positionA", StringComparison.Ordinal); 7490var methodPosition = tree.GetText().ToString().IndexOf("positionB", StringComparison.Ordinal); 8845var localFuncPosition = tree.GetText().ToString().IndexOf("positionA", StringComparison.Ordinal); 8846var methodPosition = tree.GetText().ToString().IndexOf("positionB", StringComparison.Ordinal); 9353var localFuncPosition = tree.GetText().ToString().IndexOf("positionA", StringComparison.Ordinal); 9354var methodPosition = tree.GetText().ToString().IndexOf("positionB", StringComparison.Ordinal); 9671var localFuncPosition = tree.GetText().ToString().IndexOf("positionA", StringComparison.Ordinal); 9672var methodPosition = tree.GetText().ToString().IndexOf("positionB", StringComparison.Ordinal);
Semantics\TopLevelStatementsTests.cs (1)
8783Assert.Equal(text2, tree.GetText().ToString());
SourceGeneration\GeneratorDriverTests.cs (1)
2600var contents = texts.Select((t, ct) => t?.GetText(ct)?.ToString()).WithTrackingName("Content");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (12)
Compilation\SemanticModelAPITests.cs (3)
3524var position = tree.GetText().ToString().IndexOf("class C {", StringComparison.Ordinal); 3545var position = tree.GetText().ToString().IndexOf("class C {", StringComparison.Ordinal); 4369var text = tree.GetText().ToString();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (7)
4088var position1 = tree.GetText().ToString().IndexOf("WriteLine", StringComparison.Ordinal); 4169var position = tree.GetText().ToString().IndexOf("class C {", StringComparison.Ordinal); 4212var position2 = tree.GetText().ToString().IndexOf("C goo<O>", StringComparison.Ordinal); 4221var position3 = tree.GetText().ToString().IndexOf("Serializable", StringComparison.Ordinal); 4247var position = tree.GetText().ToString().IndexOf("class C {", StringComparison.Ordinal); 4324var position2 = tree.GetText().ToString().IndexOf("C goo<O>", StringComparison.Ordinal); 4347var position3 = tree.GetText().ToString().IndexOf("Serializable", StringComparison.Ordinal);
Symbols\Source\DeclaringSyntaxNodeTests.cs (2)
138string code = tree.GetText().ToString(); 153string code = tree.GetText().ToString();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (73)
Diagnostics\DiagnosticTest.cs (1)
2374string s = syntaxTree.GetText().ToString();
Diagnostics\LocationsTests.cs (1)
68string s = syntaxTree.GetText().ToString();
IncrementalParsing\GrammarAmbiguities.cs (1)
104var parsedRoot = SyntaxFactory.ParseCompilationUnit(syntaxTree.GetText().ToString());
IncrementalParsing\IncrementalParsingTests.cs (63)
593Assert.Equal(newText.ToString(), finalText); 607Assert.Equal(newText.ToString(), output); 1053int locationOfInsert = oldText.ToString().IndexOf('0') + 1; 1157int locationOfChange = oldText.ToString().IndexOf("ON", StringComparison.Ordinal), widthOfChange = 2; 1177int locationOfChange = oldText.ToString().IndexOf("const", StringComparison.Ordinal), widthOfChange = 5; 1197int locationOfChange = oldText.ToString().IndexOf("class", StringComparison.Ordinal), widthOfChange = 5; 1220int locationOfChange = oldText.ToString().IndexOf('}'), widthOfChange = 5; 1240int locationOfChange = oldText.ToString().IndexOf('}'), widthOfChange = 5; 1260int locationOfChange = oldText.ToString().IndexOf("fixed", StringComparison.Ordinal), widthOfChange = 5; 1281int locationOfChange = oldText.ToString().IndexOf("@global", StringComparison.Ordinal), widthOfChange = 7; 1313int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 1338int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 1365Assert.Equal(parsedTree.GetText().ToString(), incrementalTree.GetText().ToString()); 1420Assert.Equal(parsedTree.GetText().ToString(), incrementalTree.GetText().ToString()); 1507Assert.Equal(parsedTree.GetText().ToString(), incrementalTree.GetText().ToString()); 1992int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2020int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2042int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2093int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2126int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2152int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2177int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2206int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2233int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2257int locationOfChange = oldText.ToString().IndexOf(textToRemove, StringComparison.Ordinal); 2288int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 2316int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 2339int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 2394Assert.Equal(oldText.ToString(), startTree.GetCompilationUnitRoot().ToFullString()); 2417newText.ToString()); 2447", newText.ToString()); 2475", newText.ToString()); 2531var fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2545fullTree = SyntaxFactory.ParseSyntaxTree(newIText.ToString(), options: newTree.Options); 2615var fullTree = SyntaxFactory.ParseSyntaxTree(currIText.ToString()); 2651var fullTree = SyntaxFactory.ParseSyntaxTree(currIText.ToString()); 2827var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2848var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2869var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2890var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2911var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2933var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2957var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 2981var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3005var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3029var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3053var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3079var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3104var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3130var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3156var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3174var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3192var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3210var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3224var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3238var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3253var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3290var fullTree = SyntaxFactory.ParseSyntaxTree(text.ToString()); 3351Assert.Equal(oldText.ToString(), startTree.GetCompilationUnitRoot().ToFullString()); 3360SourceText newText = SourceText.From(token + oldText.ToString());
Syntax\SyntaxEquivalenceTests.cs (3)
20var tree3 = SyntaxFactory.ParseSyntaxTree(tree2.GetText().ToString()); 29var tree3 = SyntaxFactory.ParseSyntaxTree(tree2.GetText().ToString()); 38var tree3 = SyntaxFactory.ParseSyntaxTree(node2.GetText().ToString());
TextExtensions.cs (4)
24var oldFullText = text.ToString(); 32var oldFullText = text.ToString(); 42var oldFullText = text.ToString(); 57var oldFullText = text.ToString();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (3)
SyntaxTreeExtensions.cs (3)
26var oldFullText = syntaxTree.GetText().ToString(); 34var oldFullText = syntaxTree.GetText().ToString(); 47var oldFullText = syntaxTree.GetText().ToString();
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (4)
CodeGeneration\AddAttributesTests.cs (1)
59var actualText = (await formatted.GetTextAsync()).ToString();
CodeGeneration\AddImportsTests.cs (3)
96var actualText = (await formatted.GetTextAsync()).ToString(); 105var actualText = (await formatted.GetTextAsync()).ToString(); 816var actualText = (await formatted.GetTextAsync()).ToString();
Microsoft.CodeAnalysis.EditorFeatures (13)
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
151return text.ToString();
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
608preMergeDocumentTextString = preMergeDocument.GetTextAsync(cancellationToken).WaitAndGetResult(cancellationToken).ToString();
IntelliSense\QuickInfo\IntellisenseQuickInfoBuilder.cs (1)
119var textRunsOfSpan = spans.Select(s => new ClassifiedTextRun(s.ClassificationType, text.GetSubText(s.TextSpan).ToString(), ClassifiedTextRunStyle.UseClassificationFont)).ToList();
Preview\AbstractPreviewFactoryService.cs (4)
622return _textBufferFactoryService.CreateTextBuffer(text.ToString(), contentType); 635return _textBufferFactoryService.CreateTextBuffer(text.ToString(), contentType); 763return diffService.DiffStrings(oldText.ToString(), newText.ToString(), new StringDifferenceOptions()
RenameTracking\RenameTrackingTaggerProvider.cs (1)
93text.ToString()));
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (2)
192Debug.Assert(newFullText.ToString() == documentWithOriginalName.GetTextSynchronously(cancellationToken).ToString());
TextDiffing\EditorTextDifferencingService.cs (3)
51: diffService.DiffStrings(oldText.ToString(), newText.ToString(), differenceOptions); 56newText.GetSubText(diffResult.RightDecomposition.GetSpanInOriginal(d.Right).ToTextSpan()).ToString())).ToImmutableArray();
Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities (12)
ChangeSignature\AbstractChangeSignatureTests.cs (2)
130var updatedCode = (await updatedInvocationDocument.GetTextAsync()).ToString(); 140Assert.True(false, CreateDiagnosticsString(diagnostics, updatedSignature, testState.InvocationDocument, totalParameters, (await testState.InvocationDocument.GetTextAsync()).ToString()));
CodeActions\AbstractCodeActionOrUserDiagnosticTest.cs (4)
700VerifyExpectedDocumentText(expectedRoot.ToString(), root.ToString()); 706var actualString = root.ToString(); 716VerifyExpectedDocumentText(expectedRoot.ToString(), actualString);
CodeActions\AbstractCodeActionOrUserDiagnosticTest_TestAddDocument.cs (1)
120var actual = (await addedDocument.GetTextAsync()).ToString();
CodeActions\AbstractCodeActionTest.cs (1)
155var previewContents = diffView.Viewer.RightView.TextBuffer.AsTextContainer().CurrentText.ToString();
CodeActions\CodeFixVerifierHelper.cs (1)
100return text?.ToString();
Diagnostics\AbstractSuppressionAllCodeTests.cs (1)
117var newText = newTree.GetText().ToString();
MoveType\AbstractMoveTypeTest.cs (1)
182var actualSourceTextAfterRefactoring = (await modifiedSourceDocument.GetTextAsync()).ToString();
SplitComments\AbstractSplitCommentCommandHandlerTests.cs (1)
85Assert.Equal(expectedOutput, view.TextBuffer.CurrentSnapshot.AsText().ToString());
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (20)
BraceHighlighting\MultiCharacterBraceHighlightingTests.cs (1)
35var text = (await document.GetTextAsync(cancellationToken)).ToString();
Completion\AbstractCompletionProviderTests.cs (4)
149var code = (await document.GetTextAsync()).ToString(); 514var actualCodeAfterCommit = textBuffer.CurrentSnapshot.AsText().ToString(); 550var actualCodeAfterCommit = textBuffer.CurrentSnapshot.AsText().ToString(); 617Assert.Equal(expectedCodeAfterCommit, text.ToString());
EditAndContinue\EditAndContinueTestHelpers.cs (1)
433var code = text.GetSubText(text.Lines.GetTextSpan(span.Span)).ToString().Replace("\r\n", " ");
ExtractInterface\AbstractExtractInterfaceTests.cs (3)
136var updatedCode = (await updatedOriginalDocument.GetTextAsync()).ToString(); 143var interfaceCode = (await interfaceDocument.GetTextAsync()).ToString(); 163var updatedCode = (await updatedDocument.GetTextAsync()).ToString();
Formatting\AbstractNewDocumentFormattingServiceTests.cs (1)
43AssertEx.EqualOrDiff(expected, actual.ToString());
Formatting\CoreFormatterTestsBase.cs (1)
292var actual = result.GetText().ToString();
LanguageServer\AbstractLanguageServerProtocolTests.cs (3)
172return text.ToString(); 330solution = solution.WithDocumentText(document.Id, SourceText.From(documentText.ToString(), System.Text.Encoding.UTF8, SourceHashAlgorithms.Default)); 612text = sourceText.ToString();
Rename\RenamerTests.cs (1)
101AssertEx.EqualOrDiff(endDocument.Text, (await updatedDocument.GetTextAsync()).ToString());
SignatureHelp\AbstractSignatureHelpProviderTests.cs (2)
357var code = (await document.GetTextAsync()).ToString(); 473var code = (await document.GetTextAsync()).ToString();
Workspaces\TestWorkspace.cs (3)
339text.ToString(), info.Name, info.SourceCodeKind, 363var hostDocument = new TestHostDocument(text.ToString(), info.Name, id: info.Id, exportProvider: ExportProvider); 385var hostDocument = new TestHostDocument(text.ToString(), info.Name, id: info.Id, filePath: info.FilePath, folders: info.Folders, exportProvider: ExportProvider);
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Implementation\TextBufferFactoryService\TextBufferCloneServiceFactory.cs (1)
52return _textBufferFactoryService.CreateTextBuffer(sourceText.ToString(), contentType);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (27)
CodeFixes\CodeFixServiceTests.cs (3)
826Assert.Equal("Additional Document", txtDocument.GetTextSynchronously(CancellationToken.None).ToString()); 827Assert.Equal($"Additional Document{fixer1.Title}", changedtxtDocument.GetTextSynchronously(CancellationToken.None).ToString()); 881var newText = SourceText.From(text.ToString() + Title);
CodeRefactorings\CodeRefactoringServiceTest.cs (5)
191Assert.Empty(txtAdditionalDocument.GetTextSynchronously(CancellationToken.None).ToString()); 192Assert.Equal(refactoring1.Title, changedtxtDocument.GetTextSynchronously(CancellationToken.None).ToString()); 230Assert.Empty(editorConfig.GetTextSynchronously(CancellationToken.None).ToString()); 231Assert.Equal(refactoring1.Title, changedEditorConfig.GetTextSynchronously(CancellationToken.None).ToString()); 255var newText = SourceText.From(text.ToString() + Title);
EditAndContinue\CompileTimeSolutionProviderTests.cs (1)
104return "// " + additionalText.GetText(ct)!.ToString();
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (5)
446Generate(syntaxTree.GetText().ToString(), fileName); 456Generate(additionalFile.GetText()!.ToString(), PathUtilities.GetFileName(additionalFile.Path)); 1936context.AddSource("Generated.cs", context.AdditionalFiles.FirstOrDefault()?.GetText().ToString() ?? "none"); 4724Assert.Equal(source1, (await documentState.GetTextAsync(CancellationToken.None)).ToString()); 4731Assert.Equal(source1, (await document.GetTextAsync(CancellationToken.None)).ToString());
EditorAdapter\TextSnapshotImplementationTest.cs (1)
35Assert.Equal(tuple.Item1.GetText(), text.ToString());
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (2)
71Assert.Equal(expectedMergedText, (await workspace.CurrentSolution.GetDocument(documentId).GetTextAsync()).ToString()); 72Assert.Equal(expectedMergedText, (await workspace.CurrentSolution.GetDocument(linkedDocumentId).GetTextAsync()).ToString());
Preview\PreviewWorkspaceTests.cs (1)
91Assert.Equal(previewWorkspace.CurrentSolution.Projects.First().Documents.First().GetTextAsync().Result.ToString(), text);
TextEditor\OpenDocumentTests.cs (4)
64Assert.Equal("Hello, World!", newDocumentWithChanges.GetTextSynchronously(CancellationToken.None).ToString()); 65Assert.Equal("Hello, World!", newDocumentWithChanges.GetLinkedDocuments().Single().GetTextSynchronously(CancellationToken.None).ToString()); 70Assert.Equal("Hello", originalDocumentWithChanges.GetTextSynchronously(CancellationToken.None).ToString()); 71Assert.Equal("Hello", originalDocumentWithChanges.GetLinkedDocuments().Single().GetTextSynchronously(CancellationToken.None).ToString());
TextEditor\TryGetDocumentTests.cs (1)
44Assert.Equal(expected, newSourceText.ToString());
Workspaces\TextFactoryTests.cs (4)
94Assert.Equal(text.ToString(), text2.ToString()); 116Assert.Equal(text.ToString(), text2.ToString());
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (10)
Diagnostics\AbstractCrossLanguageUserDiagnosticTest.vb (1)
117Dim actual = (Await updatedDocument.GetTextAsync()).ToString().Trim()
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
60Dim actual = updatedDocument.GetTextAsync().Result.ToString().Trim()
Diagnostics\DiagnosticServiceTests.vb (1)
1491Dim additionalFileText = compilationContext.Options.AdditionalFiles.Single().GetText().ToString()
Diagnostics\UseAutoProperty\UseAutoPropertyTests.vb (1)
145Dim text = (Await doc.GetTextAsync()).ToString().Trim()
Expansion\AbstractExpansionTest.vb (1)
51Dim actualText = (Await document.GetTextAsync()).ToString()
FindReferences\FindReferencesTests.vb (1)
566solution = solution.WithDocumentText(document2.Id, SourceText.From(text1.ToString().Replace("int i", "int j")))
InlineHints\AbstractInlineHintsTests.vb (2)
69Dim newText = value.WithChanges(textChanges).ToString() 72AssertEx.Equal(expectedText.ToString(), newText)
Simplification\AbstractSimplificationTests.vb (1)
129Dim actualText = (Await simplifiedDocument.GetTextAsync()).ToString()
Simplification\ParameterSimplificationTests.vb (1)
31Assert.Equal(expected, (Await simplifiedDocument.GetTextAsync()).ToString())
Microsoft.CodeAnalysis.Features (3)
AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (1)
182return SyntaxFacts.GetNameOfMemberAccessExpression(memberAccess).GetText().ToString();
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
187var token = syntaxFacts.ParseToken(text.ToString());
ValueTracking\ValueTrackedItem.cs (1)
46return subText.ToString();
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Handler\Completion\CompletionHandler.cs (1)
371var filterText = sourceText.GetSubText(completionListSpan).ToString();
Handler\InlineCompletions\InlineCompletionsHandler.cs (2)
88var wordText = sourceText.GetSubText(wordOnLeft.Value).ToString(); 188return formattedLspSnippetText.ToString();
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (24)
CodeActions\RunCodeActionsTests.cs (1)
58Assert.Equal(expectedTextForB, textForB.ToString());
DocumentChanges\DocumentChangesTests.cs (8)
56Assert.Equal(documentText, document.ToString()); 61Assert.Equal(expected, document.ToString()); 89Assert.Equal(documentText, document.ToString()); 207Assert.Equal(expected, document.ToString()); 239var documentTextFromWorkspace = (await testLspServer.GetCurrentSolution().GetDocuments(locationTyped.Uri).Single().GetTextAsync()).ToString(); 281Assert.Equal(expected, document.ToString()); 319Assert.Equal(expected, document.ToString()); 329return (testLspServer, locationTyped, documentText.ToString());
DocumentChanges\DocumentChangesTests.LinkedDocuments.cs (2)
43Assert.Equal(documentText, document.GetTextSynchronously(CancellationToken.None).ToString()); 94Assert.Equal(updatedText, document.GetTextSynchronously(CancellationToken.None).ToString());
Workspaces\LspWorkspaceManagerTests.cs (13)
39Assert.Equal("LSP text", (await lspDocument.GetTextAsync(CancellationToken.None)).ToString()); 45Assert.Equal("More textLSP text", (await lspDocument.GetTextAsync(CancellationToken.None)).ToString()); 83Assert.Equal($"Some more text{markupOne}", (await firstDocumentWithChange.GetTextAsync(CancellationToken.None)).ToString()); 113Assert.Equal("LSP text", (await openedDocument.GetTextAsync(CancellationToken.None)).ToString()); 118Assert.Equal("Two is now three!", (await secondDocument.GetTextAsync()).ToString()); 141Assert.Equal(markup, (await openedDocument.GetTextAsync(CancellationToken.None)).ToString()); 165Assert.Equal("LSP text", (await openedDocument.GetTextAsync(CancellationToken.None)).ToString()); 214Assert.Equal("LSP text", (await miscDocument.GetTextAsync(CancellationToken.None)).ToString()); 221Assert.Equal("More LSP textLSP text", miscText.ToString()); 233Assert.Equal("More LSP textLSP text", documentText.ToString()); 449Assert.Equal("Original text", (await documentServerTwo.GetTextAsync(CancellationToken.None)).ToString()); 479Assert.Equal("Text", (await lspDocument.GetTextAsync(CancellationToken.None)).ToString()); 491Assert.Equal(openText, (await lspDocument.GetTextAsync(CancellationToken.None)).ToString());
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator (1)
Generator.cs (1)
422contentBase64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(text.ToString()));
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests (1)
ProjectStructureTests.vb (1)
63Assert.Equal(tree.GetText().ToString(), contents)
Microsoft.CodeAnalysis.Scripting (2)
Hosting\CommandLine\CommandLineRunner.cs (1)
137RunInteractiveLoop(scriptOptions, code?.ToString(), cancellationToken);
Script.cs (1)
74public string Code => SourceText.ToString();
Microsoft.CodeAnalysis.Test.Utilities (1)
Metadata\ILValidation.cs (1)
425return subtext.ToString();
Microsoft.CodeAnalysis.TestAnalyzerReference (1)
NonSourceFileRefactoring.cs (1)
30var newText = SourceText.From(text.ToString() + Environment.NewLine + "# Refactored");
Microsoft.CodeAnalysis.UnitTests (116)
Text\LargeTextTests.cs (2)
47Assert.Equal(HelloWorld, text.ToString()); 168Assert.Equal(text.ToString().Substring(start, length), textLine.ToString());
Text\SourceTextTests.cs (1)
36Assert.Same(string.Empty, text.ToString());
Text\StringTextDecodingTests.cs (6)
62Assert.Equal(sjis.GetString(TestResources.General.ShiftJisSource), data.ToString()); 72Assert.Equal(sjis.GetString(TestResources.General.ShiftJisSource), data.ToString()); 171Assert.Equal(text, sourceText.ToString()); 196Assert.Equal(text, sourceText.ToString()); 226Assert.Equal(expectedText, sourceText.ToString()); 312Assert.Equal(expectedText, encodedText.ToString());
Text\StringTextTest.cs (5)
121Assert.Equal(text.ToString().Substring(start, length), textLine.ToString()); 235Assert.Equal("abc", source.ToString()); 250Assert.Equal("ab?", source.ToString()); 262Assert.Equal("\u1234", source.ToString()); 277Assert.Equal("abc", source.ToString());
Text\StringTextTests_Default.cs (1)
148Assert.Equal(originalText, encodedText.ToString());
Text\TextChangeTests.cs (101)
34Assert.Equal("World", subText.ToString()); 42Assert.Equal("Hello", subText.ToString()); 50Assert.Equal("World", subText.ToString()); 58Assert.Equal("o W", subText.ToString()); 66Assert.Equal("Hello Beautiful World", newText.ToString()); 91Assert.Equal("Halo Universe", newText.ToString()); 118Assert.Equal("Halo Universe", newText.ToString()); 145Assert.Equal("Hello Super Spectacular World", newText.ToString()); 157Assert.Equal("Hello Super Vurld", newText.ToString()); 171Assert.Equal("Hello Super Vurld", newText.ToString()); 183Assert.Equal("HellWorld", newText.ToString()); 195Assert.Equal("l Un", subText.ToString()); 271Assert.Equal(SourceText.From(changedText.ToString()).Lines, changedText.Lines, new TextLineEqualityComparer()); 361Assert.Equal(expected, text.ToString()); 381Assert.Equal(expected, text.ToString()); 394Assert.Equal("fghijklmno", subtext.ToString()); 432Assert.Equal("abcdefghij", newText.Segments[0].ToString()); 433Assert.Equal("lmnopqrstuvwxyz", newText.Segments[1].ToString()); 445Assert.Equal("abcdefghij*klmnopqrstuvwxyz", textWithSegments.ToString()); 448Assert.Equal("abcdefghij", textWithSegments.Segments[0].ToString()); 449Assert.Equal("*", textWithSegments.Segments[1].ToString()); 450Assert.Equal("klmnopqrstuvwxyz", textWithSegments.Segments[2].ToString()); 464Assert.Equal("abcdefghilmnopqrstuvwxyz", textWithFewerSegments.ToString()); 469Assert.Equal("abcdefghi", textWithFewerSegments.Segments[0].ToString()); 470Assert.Equal("lmnopqrstuvwxyz", textWithFewerSegments.Segments[1].ToString()); 495Assert.Equal(a, t.Segments[0].ToString()); 496Assert.Equal(b, t.Segments[1].ToString()); 508Assert.Equal(a, t.Segments[0].ToString()); 509Assert.Equal(b, t.Segments[1].ToString()); 510Assert.Equal(new string('c', t.Segments[2].Length), t.Segments[2].ToString()); 525Assert.Equal(a, t.Segments[0].ToString()); 526Assert.Equal(b, t.Segments[1].ToString()); 659Assert.Equal("Hello Cool World", change2.ToString()); 676Assert.Equal("0aa4", change1.ToString()); 677Assert.Equal("0abba4", change2.ToString()); 690Assert.Equal("0aaa2", change1.ToString()); 691Assert.Equal("0aabba2", change2.ToString()); 704Assert.Equal("0aa4", change1.ToString()); 705Assert.Equal("0abb4", change2.ToString()); 715Assert.Equal("Heard", change2.ToString()); 729Assert.Equal("Hell Bell World", change2.ToString()); 743Assert.Equal("Hello Cwazy Vorld", change2.ToString()); 759Assert.Equal("0aa1234", change1.ToString()); 760Assert.Equal("0bbaa1234", change2.ToString()); 772Assert.Equal("0aa4", change1.ToString()); 773Assert.Equal("0bbaa4", change2.ToString()); 785Assert.Equal("0aa1234", change1.ToString()); 786Assert.Equal("0bba1234", change2.ToString()); 798Assert.Equal("0aa1234", change1.ToString()); 799Assert.Equal("0bb1234", change2.ToString()); 811Assert.Equal("0aa1234", change1.ToString()); 812Assert.Equal("0bb234", change2.ToString()); 825Assert.Equal("0aa4", change1.ToString()); 826Assert.Equal("0bba4", change2.ToString()); 839Assert.Equal("0aa4", change1.ToString()); 840Assert.Equal("0bb", change2.ToString()); 849Assert.Equal("Hello World", change2.ToString()); 863Assert.Equal("Hello World", change2.ToString()); 879Assert.Equal("Hello World", change2.ToString()); 894Assert.Equal("Hell World", change1.ToString()); 896Assert.Equal("Hello World", change2.ToString()); 914Assert.Equal("Hello World", final.ToString()); 1012Assert.Equal(originalText.WithChanges(textChanges).ToString(), change2.ToString()); 1049Assert.Equal("a234", change1.ToString()); 1050Assert.Equal("bb34", change2.ToString()); 1053Assert.Equal("bb34", originalText.WithChanges(changes).ToString()); 1065Assert.Equal("aa0aa234", change1.ToString()); 1066Assert.Equal("baa234", change2.ToString()); 1067Assert.Equal(change2.ToString(), original.WithChanges(changes).ToString()); 1077Assert.Equal("a01234", change1.ToString()); 1078Assert.Equal("bb1234", change2.ToString()); 1081Assert.Equal("bb1234", originalText.WithChanges(changes).ToString()); 1091Assert.Equal("aa12aa4", change1.ToString()); 1092Assert.Equal("bbbaa12aa4", change2.ToString()); 1094Assert.Equal("bbbaa12aa4", originalText.WithChanges(changes).ToString()); 1104Assert.Equal("a34aaa5", change1.ToString()); 1105Assert.Equal("4bbaa5", change2.ToString()); 1108Assert.Equal("4bbaa5", originalText.WithChanges(changes).ToString()); 1118Assert.Equal("aaaaa12aaaa45aaaaa7", change1.ToString()); 1119Assert.Equal("baababbbbbaabbbbba7", change2.ToString()); 1122Assert.Equal("baababbbbbaabbbbba7", originalText.WithChanges(changes).ToString()); 1132Assert.Equal("a1234", change1.ToString()); 1133Assert.Equal("b1b4", change2.ToString()); 1136Assert.Equal("b1b4", originalText.WithChanges(changes).ToString()); 1146Assert.Equal("aa1234", change1.ToString()); 1147Assert.Equal("bab234", change2.ToString()); 1150Assert.Equal("bab234", originalText.WithChanges(changes).ToString()); 1160Assert.Equal("a2a5", change1.ToString()); 1161Assert.Equal("bbb5", change2.ToString()); 1164Assert.Equal("bbb5", originalText.WithChanges(changes).ToString()); 1174Assert.Equal("46", change1.ToString()); 1175Assert.Equal("6", change2.ToString()); 1178Assert.Equal("6", originalText.WithChanges(changes).ToString()); 1188Assert.Equal("245", change1.ToString()); 1189Assert.Equal("5", change2.ToString()); 1192Assert.Equal("5", originalText.WithChanges(changes).ToString()); 1202Assert.Equal("134", change1.ToString()); 1203Assert.Equal("14", change2.ToString()); 1206Assert.Equal("14", originalText.WithChanges(changes).ToString());
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (1)
CommandLineTests.vb (1)
3412Assert.Equal(expectedEmbeddedMap(docPath), embeddedSource.ToString())
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (12)
CaseCorrecting\CaseCorrectionServiceTests.vb (1)
45Dim actual = newDocument.GetTextSynchronously(CancellationToken.None).ToString()
ChangeSignature\ReorderParameters.MultiFile.vb (4)
63Assert.Equal(expectedCSharpCode, (Await csdoc.GetTextAsync()).ToString()) 64Assert.Equal(expectedVBCode, (Await vbdoc.GetTextAsync()).ToString()) 116Assert.Equal(expectedCSharpCode, (Await csdoc.GetTextAsync()).ToString()) 117Assert.Equal(expectedVBCode, (Await vbdoc.GetTextAsync()).ToString())
CodeActions\Preview\PreviewTests.vb (1)
99Dim text = diffView.Viewer.RightView.TextBuffer.AsTextContainer().CurrentText.ToString()
ExtractInterface\ExtractInterfaceTests.vb (2)
1195Assert.Equal(expectedDoc1Text, (Await result.UpdatedSolution.GetDocument(part1Id).GetTextAsync()).ToString()) 1196Assert.Equal(expectedDoc2Text, (Await result.UpdatedSolution.GetDocument(part2Id).GetTextAsync()).ToString())
Formatting\CodeCleanUpTests.vb (2)
551AssertEx.EqualOrDiff(expected, actual.ToString()) 603AssertEx.EqualOrDiff(expected, actual.ToString())
ImplementAbstractClass\ImplementAbstractClassCommandHandlerTests.vb (1)
215Dim text = view.TextBuffer.CurrentSnapshot.AsText().ToString()
ImplementInterface\ImplementInterfaceCommandHandlerTests.vb (1)
30Dim text = view.TextBuffer.CurrentSnapshot.AsText().ToString()
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
PDB\PDBEmbeddedSourceTests.vb (1)
110Assert.Equal(source, embeddedSource.Text.ToString())
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (1)
ScriptTests.vb (1)
62Assert.Equal(script.Code, compilation.SyntaxTrees.First().GetText().ToString())
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (16)
Binding\BindingScopeTests.vb (1)
18Dim treeText As String = tree.GetText().ToString()
Compilation\GetSemanticInfoBrokenCodeTests.vb (1)
139Dim position = oldText.ToString().LastIndexOf("Module", StringComparison.Ordinal)
Compilation\MyTemplateTests.vb (3)
52Assert.Contains("Private ReadOnly m_Context As New Global.Microsoft.VisualBasic.MyServices.Internal.ContextValue(Of T)", sourceText.ToString(), StringComparison.Ordinal) 75Dim text = MyTemplate.GetText.ToString 98Dim text = MyTemplate.GetText.ToString
DeclaringSyntaxNodeTests.vb (6)
104Dim code As String = tree.GetText().ToString() 118Dim code As String = tree.GetText().ToString() 129Dim code As String = tree.GetText().ToString() 230Dim text = tree.GetText().ToString() 265Dim text = tree.GetText().ToString() 306Dim text = tree.GetText().ToString()
Diagnostics\GetDiagnosticsTests.vb (3)
33Dim sourceText = compilation.SyntaxTrees.Single().GetText().ToString() 64Dim sourceText = compilation.SyntaxTrees.Single().GetText().ToString() 82Dim sourceText = compilation.SyntaxTrees.Single().GetText().ToString()
Semantics\GetUnusedImportDirectivesTests.vb (1)
56Dim position = tree.GetText().ToString().IndexOf("' Comment", StringComparison.Ordinal)
SourceGeneration\GeneratorDriverTests.vb (1)
47Sub(e) Assert.Equal("Hello World", e.AdditionalFiles.First().GetText().ToString()))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
DocumentationComments\DocCommentTests.vb (1)
12084Dim text As String = tree.GetText().ToString()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (52)
IncrementalParser\IncrementalParser.vb (45)
136Dim newString = newText.ToString() 887Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 908Dim position = oldText.ToString().LastIndexOf("Module", StringComparison.Ordinal) 937Dim position = oldText.ToString().IndexOf("False", StringComparison.Ordinal) 966Dim position = oldText.ToString().LastIndexOf("Module", StringComparison.Ordinal) 990Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) + str.Length 1011Dim position = oldText.ToString().IndexOf("'Else", StringComparison.Ordinal) 1031Dim position = oldText.ToString().IndexOf("X"c) 1055Dim position = oldText.ToString().Length 1081Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1107Dim position = oldText.ToString().LastIndexOf(str, StringComparison.Ordinal) 1127Dim fulltree = VisualBasicSyntaxTree.ParseText(newIText.ToString()) 1172Dim fulltree = VisualBasicSyntaxTree.ParseText(newIText.ToString()) 1268Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1292Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1316Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1340Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1363Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1386Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1406Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1426Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1446Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1466Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) 1490Dim position = oldText.ToString().IndexOf("#"c) 1585Dim position = oldText.ToString().IndexOf("&HFFFFFFFFFF:", StringComparison.Ordinal) 1770Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 1797Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 1826Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 1890Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 1923Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 1957Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 1987Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2018Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2050Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2080Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2112Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2214Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2246Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2280Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2306Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2337Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2370Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2407Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2435Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal) 2469Dim position = oldText.ToString.IndexOf(TextToRemove, StringComparison.Ordinal)
LocationTests.vb (1)
56Dim s = tree.GetText().ToString()
Parser\ParseDirectives.vb (3)
3387Dim index = tree.GetText.ToString.IndexOf(text, 0, StringComparison.Ordinal) 3462Dim endPos = tree.GetText.ToString.Length 3522Dim endPos = tree.GetText.ToString.Length
Syntax\SyntaxEquivalenceTests.vb (2)
16Dim tree3 = VisualBasicSyntaxTree.ParseText(tree2.GetText().ToString()) 23Dim tree3 = VisualBasicSyntaxTree.ParseText(tree2.GetText().ToString())
TestSyntaxNodes.vb (1)
3343Assert.Equal("#if True then", x(0).GetText.ToString.TrimEnd)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (9)
CompilationTestUtils.vb (3)
646Dim text As String = tree.GetText().ToString() 654Dim text As String = tree.GetText().ToString() 1118Dim text As String = tree.GetText().ToString()
ParserTestUtilities.vb (2)
221Dim newText = newIText.ToString 222Dim oldText = oldIText.ToString
SemanticModelTestBase.vb (1)
23Dim text As String = tree.GetText().ToString()
SyntaxTreeExtensions.vb (3)
24Dim oldFullText = syntaxTree.GetText().ToString() 32Dim oldFullText = syntaxTree.GetText().ToString() 45Dim oldFullText = syntaxTree.GetText().ToString()
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (4)
CaseCorrection\VisualBasicCaseCorrectionTestBase.vb (1)
22AssertEx.EqualOrDiff(expected, actual.ToString())
CodeGeneration\AddImportsTests.vb (2)
102Dim actualText = (Await formatted.GetTextAsync()).ToString() 109Dim actualText = (Await formatted.GetTextAsync()).ToString()
Formatting\FormattingTests.vb (1)
4211Dim actual = (Await document.GetTextAsync()).ToString()
Microsoft.CodeAnalysis.Workspaces (5)
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
73var allText = text.ToString(); // Entire document as string to allow inspecting the text in the debugger.
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (1)
114? text.GetSubText(TextSpan.FromBounds(text.Lines[startLine].Start, text.Lines[endLine].End)).ToString()
Shared\Extensions\SourceTextExtensions.cs (1)
172writer.WriteString(sourceText.ToString());
Workspace\Solution\DocumentState.cs (2)
699var newTextContent = newText.ToString(); 702var oldTextContent = oldText?.ToString();
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (32)
VisualStudioMSBuildWorkspaceTests.cs (32)
954Assert.NotEmpty(text.ToString()); 979Assert.Empty(text.ToString()); 2012Assert.Equal(newText.ToString(), text2.ToString()); 2017Assert.Equal(newText.ToString(), textOnDisk); 2055Assert.Equal(newText.ToString(), text2.ToString()); 2059Assert.Equal(newText.ToString(), textOnDisk); 2064Assert.Equal(originalText.ToString(), text.ToString()); 2091Assert.Equal(originalText.ToString(), text.ToString()); 2105var newText = SourceText.From("using System.Diagnostics;\r\n" + text.ToString()); 2114Assert.Equal(newText.ToString(), text2.ToString()); 2118Assert.Equal(newText.ToString(), textOnDisk); 2132var newText = SourceText.From("New Text In Additional File.\r\n" + text.ToString()); 2141Assert.Equal(newText.ToString(), text2.ToString()); 2145Assert.Equal(newText.ToString(), textOnDisk); 2167Assert.Equal(newText.ToString(), text2.ToString()); 2171Assert.Equal(newText.ToString(), textOnDisk); 2228var newText = "/* new text */\r\n" + text.ToString(); 2258var newText = "/* new text */\r\n" + text.ToString(); 2342Assert.Contains("Window", text.ToString(), StringComparison.Ordinal); 2364Assert.Contains("Window", atav.Text.ToString(), StringComparison.Ordinal); 2383Assert.Contains("Window", atext.ToString(), StringComparison.Ordinal); 2799Assert.Equal("//\u201C", text.ToString()); 2859Assert.Equal(fileContent, text.ToString()); 2872var noEncodingDoc = document.WithText(SourceText.From(text.ToString(), encoding: null)); 3182Assert.Equal("root = true", text.ToString());
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Formatting\FormattingTestBase.cs (1)
135var actual = sourceText.WithChanges(result).ToString();
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
35return SourceText.From(generatedText.ToString(), encoding: Encoding.UTF8);
Microsoft.CodeAnalysis.Workspaces.UnitTests (71)
CommandLineProject\CommandLineProjectWorkspaceTests.cs (1)
43var text = (await gooDoc.GetTextAsync()).ToString();
Formatter\FormatterTests.cs (3)
59AssertEx.Equal(@"Formatted with options: LineFormattingOptions { UseTabs = False, TabSize = 4, IndentationSize = 4, NewLine = \r\n }", formattedText.ToString()); 101AssertEx.Equal(@"Formatted with options: LineFormattingOptions { UseTabs = True, TabSize = 5, IndentationSize = 6, NewLine = \r }", formattedText.ToString()); 106AssertEx.Equal(@"Formatted with options: LineFormattingOptions { UseTabs = False, TabSize = 1, IndentationSize = 7, NewLine = \n }", formattedText.ToString());
LinkedFileDiffMerging\LinkedFileDiffMergingTests.cs (1)
53AssertEx.EqualOrDiff(expectedMergedText, mergedSolution.GetDocument(documentIds[i]).GetTextAsync().Result.ToString());
SolutionTests\ProjectSemanticVersionTests.cs (12)
44var position = text.ToString().LastIndexOf('{') + 1; 58var position = text.ToString().LastIndexOf('{') + 1; 72var position = text.ToString().LastIndexOf('(') + 1; 86var position = text.ToString().IndexOf('{') + 1; 100var position = text.ToString().IndexOf('{') + 1; 114var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 128var position = text.ToString().IndexOf('{') + 1; 142var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 184var position = text.ToString().IndexOf('(') + 1; 226var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 240var position = text.ToString().IndexOf('{') + 1; 254var span = new TextSpan(text.ToString().IndexOf("20"), length: 2);
SolutionTests\SolutionTests.cs (44)
420Assert.Equal(text1.ToString(), text2.ToString()); 443Assert.NotEqual(text1.ToString(), text2.ToString()); 464Assert.Equal(text1.ToString(), text2.ToString()); 508Assert.Equal(text1.ToString(), text2.ToString()); 531Assert.NotEqual(text1.ToString(), text2.ToString()); 552Assert.Equal(text1.ToString(), text2.ToString()); 587Assert.Equal(text1.ToString(), text2.ToString()); 614Assert.NotEqual(text1.ToString(), text2.ToString()); 638Assert.Equal(text1.ToString(), text2.ToString()); 673Assert.Equal(text1.ToString(), text2.ToString()); 697Assert.NotEqual(text1.ToString(), text2.ToString()); 718Assert.Equal(text1.ToString(), text2.ToString()); 750Assert.Equal(text1.ToString(), text2.ToString()); 773Assert.NotEqual(text1.ToString(), text2.ToString()); 794Assert.Equal(text1.ToString(), text2.ToString()); 903Assert.Equal("new text", newSolution1.GetDocument(documentId)!.GetTextSynchronously(CancellationToken.None).ToString()); 925Assert.Equal("new text", newSolution1.GetAdditionalDocument(documentId)!.GetTextSynchronously(CancellationToken.None).ToString()); 947Assert.Equal("new text", newSolution1.GetAnalyzerConfigDocument(documentId)!.GetTextSynchronously(CancellationToken.None).ToString()); 1752Assert.Equal("text", sourceText.ToString()); 1842Assert.Equal("class C {}", sourceText.ToString()); 1871Assert.Equal("class C {}", sourceText.ToString()); 2521var newText = solution2.GetDocument(documentId).GetTextAsync().Result.ToString(); 2677Assert.Equal(text1, observedText2.ToString()); 2697Assert.Equal(text, docText.ToString()); 2719Assert.Equal(text, docText.ToString()); 2744Assert.Equal(text, docText.ToString()); 2893Assert.Equal(expectedText, observedText.ToString()); 2924Assert.Equal(expectedText, observedText.ToString()); 3282Assert.Equal("", text.ToString());
SolutionTests\SolutionWithSourceGeneratorTests.cs (2)
267Assert.Equal(expectedGeneratedContents, generatedSyntaxTree.GetText().ToString()); 317var texts = compilation.SyntaxTrees.Select(t => t.GetText().ToString());
SymbolKeyTests.cs (1)
1348var newTree = syntaxTree.WithChangedText(text.WithChanges(new TextChange(new TextSpan(0, text.Length), text.ToString().Replace(" ", " "))));
SyntaxPathTests.cs (2)
411var oldFullText = text.ToString(); 437offset: syntaxTree.GetText().ToString().IndexOf(oldText, startIndex, StringComparison.Ordinal),
UtilityTest\SourceTextSerializationTests.cs (2)
46Assert.Equal(originalText.ToString(), recovered.ToString());
WorkspaceServiceTests\TemporaryStorageServiceTests.cs (2)
81Assert.Equal(text.ToString(), text2.ToString());
WorkspaceTests\AdhocWorkspaceTests.cs (1)
79Assert.Equal(source, (await doc.GetTextAsync()).ToString());
Microsoft.VisualStudio.LanguageServices (12)
CallHierarchy\CallHierarchyDetail.cs (1)
53return location.SourceTree.GetText().GetSubText(TextSpan.FromBounds(start, end)).ToString();
CodeLens\RemoteCodeLensReferencesService.cs (1)
217return (reference.Value.Content.ToString().TrimEnd(),
FindReferences\Entries\AbstractDocumentSpanEntry.cs (1)
54StandardTableKeyNames.Text => _lineText.ToString().Trim(),
Preview\FileChange.cs (6)
58_buffer = bufferFactory.CreateTextBuffer(bufferText.ToString(), bufferFactory.InertContentType); 105var leftText = oldText.GetSubText(leftSpan.ToTextSpan()).ToString(); 106var rightText = newText.GetSubText(rightSpan.ToTextSpan()).ToString(); 125var text = document.GetTextAsync().Result.ToString(); 244var oldString = oldText.ToString(); 245var newString = newText.ToString();
Preview\PreviewUpdater.cs (1)
89var documentText = document.GetTextSynchronously(CancellationToken.None).ToString();
Preview\TopLevelChange.cs (1)
151var oldText = oldDocument.GetTextAsync().Result.ToString();
Workspace\SourceGeneratedFileManager.cs (1)
384edit.Replace(startPosition: 0, _textBuffer.CurrentSnapshot.Length, generatedSource.ToString());
Microsoft.VisualStudio.LanguageServices.CSharp (1)
LanguageService\CSharpHelpContextService.cs (1)
89return text.GetSubText(TextSpan.FromBounds(start, end)).ToString();
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (3)
CodeModel\FileCodeFunctionTests.cs (2)
497var position = text.ToString().IndexOf("DynamicMethod", StringComparison.Ordinal); 510var position = text.ToString().IndexOf("protected virtual string MethodB", StringComparison.Ordinal) - 1;
DocumentOutline\DocumentOutlineTestsBase.cs (1)
127solution = solution.WithDocumentText(document.Id, SourceText.From(documentText.ToString(), System.Text.Encoding.UTF8));
Microsoft.VisualStudio.LanguageServices.Implementation (1)
Options\AbstractOptionPreviewViewModel.cs (1)
143var textBuffer = _textBufferFactoryService.CreateTextBuffer(formatted.GetTextSynchronously(CancellationToken.None).ToString(), _contentType);
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
316if (string.IsNullOrEmpty(text.ToString()))
Microsoft.VisualStudio.LanguageServices.UnitTests (21)
CodeModel\AbstractCodeElementTests`1.vb (2)
68Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString() 80Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString()
CodeModel\AbstractFileCodeModelTests.vb (2)
22Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString() 35Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString()
CodeModel\CSharp\FileCodeModelTests.vb (2)
1210Assert.Equal(codeBeforeOperation, textBeforeOperation.ToString()) 1224Assert.Equal(codeAfterOperation, textAfterOperation.ToString())
CodeModel\VisualBasic\FileCodeModelTests.vb (1)
239Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString()
Preview\PreviewChangesTests.vb (6)
162Dim finalText = previewEngine.FinalSolution.GetDocument(documentId).GetTextAsync().Result.ToString() 163Assert.Equal(document.GetTextAsync().Result.ToString(), finalText) 239Dim changedDocText = finalSolution.GetDocument(docId).GetTextAsync().Result.ToString() 240Assert.Equal(forkedDocument.GetTextAsync().Result.ToString(), changedDocText) 242Dim finalAddedDocText = finalSolution.GetDocument(addedDocumentId1).GetTextAsync().Result.ToString() 245Dim finalNotRemovedDocText = finalSolution.GetDocument(removedDocumentId2).GetTextAsync().Result.ToString()
ProjectSystemShim\VisualStudioProjectTests\DynamicFileTests.vb (1)
43dynamicSourceFile.GetTextSynchronously(CancellationToken.None).ToString())
Snippets\CSharpSnippetExpansionClientTests.vb (1)
415(Await updatedDocument.GetTextAsync()).ToString())
Snippets\VisualBasicSnippetExpansionClientTests.vb (1)
432(Await updatedDocument.GetTextAsync()).ToString())
Venus\DocumentService_IntegrationTests.vb (1)
188Assert.Equal(String.Empty, (Await newDocument.GetTextAsync()).ToString())
Venus\DocumentServiceTests.vb (4)
143Dim content = result.Value.Content.ToString() 182Dim content = result.Value.Content.ToString() 229Dim content = result.Value.Content.ToString() 282Dim content = result.Value.Content.ToString()
Roslyn.VisualStudio.Next.UnitTests (8)
Remote\SnapshotSerializationTests.cs (4)
620Assert.Equal(sourceText.ToString(), newText.ToString()); 639Assert.Equal(sourceText.ToString(), newText.ToString());
Services\ServiceHubServicesTests.cs (4)
97Assert.Equal(newText.ToString(), (await serializableRemoteText.GetTextAsync(CancellationToken.None)).ToString()); 442return SourceText.From(document.State.GetTextSynchronously(CancellationToken.None).ToString() + csAddition); 445return SourceText.From(document.State.GetTextSynchronously(CancellationToken.None).ToString() + vbAddition);