1 write to TestWorkspace
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
507
TestWorkspace
= testWorkspace;
145 references to TestWorkspace
IdeBenchmarks (1)
Lsp\LspCompletionBenchmarks.cs (1)
96
_globalOptionService = _testServer.
TestWorkspace
.GetService<IGlobalOptionService>();
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (11)
LanguageServer\AbstractLanguageServerProtocolTests.cs (11)
519
TestWorkspace
.GetService<LspWorkspaceRegistrationService>().Register(GetManagerAccessor().GetLspMiscellaneousFilesWorkspace());
528
var workspaceWaiter = GetWorkspaceWaiter(
TestWorkspace
);
611
var sourceText = await
TestWorkspace
.CurrentSolution.GetDocuments(documentUri).First().GetTextAsync(CancellationToken.None).ConfigureAwait(false);
667
public Solution GetCurrentSolution() =>
TestWorkspace
.CurrentSolution;
671
var listenerProvider =
TestWorkspace
.GetService<IAsynchronousOperationListenerProvider>();
692
TestWorkspace
.GetService<LspWorkspaceRegistrationService>().Deregister(
TestWorkspace
);
693
TestWorkspace
.GetService<LspWorkspaceRegistrationService>().Deregister(GetManagerAccessor().GetLspMiscellaneousFilesWorkspace());
695
var solutionCrawlerRegistrationService = (SolutionCrawlerRegistrationService)
TestWorkspace
.Services.GetRequiredService<ISolutionCrawlerRegistrationService>();
696
solutionCrawlerRegistrationService.Unregister(
TestWorkspace
);
709
TestWorkspace
.Dispose();
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (133)
CodeActions\RunCodeActionsTests.cs (1)
56
var documentForB = testLspServer.
TestWorkspace
.CurrentSolution.Projects.Single().Documents.Single(doc => doc.Name.Equals("B.cs", StringComparison.OrdinalIgnoreCase));
Completion\CompletionResolveTests.cs (1)
186
document, new TestCaretOutOfScopeCompletionService(testLspServer.
TestWorkspace
.Services.SolutionServices), selectedItem, snippetsSupported: true, CancellationToken.None).ConfigureAwait(false);
Completion\CompletionTests.cs (4)
210
var solution = testLspServer.
TestWorkspace
.CurrentSolution;
213
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces, LanguageNames.CSharp, true);
236
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(CompletionOptionsStorage.SnippetsBehavior, LanguageNames.CSharp, SnippetsRule.NeverInclude);
1289
var globalOptions = testLspServer.
TestWorkspace
.GetService<IGlobalOptionService>();
Definitions\GoToDefinitionTests.cs (1)
84
AddMappedDocument(testLspServer.
TestWorkspace
, markup);
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
63
var optionService = testLspServer.
TestWorkspace
.GetService<IGlobalOptionService>();
Diagnostics\AdditionalFileDiagnosticsTests.cs (1)
79
await testLspServer.
TestWorkspace
.ChangeSolutionAsync(newSolution);
Diagnostics\PullDiagnosticTests.cs (51)
59
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
81
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
118
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
143
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
166
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
194
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
212
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
217
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(DiagnosticOptionsStorage.LspPullDiagnosticsFeatureFlag, false);
231
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
235
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(DiagnosticOptionsStorage.LspPullDiagnosticsFeatureFlag, true);
247
var workspace = testLspServer.
TestWorkspace
;
281
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
308
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
321
var encDiagnosticsSource = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<EditAndContinueDiagnosticUpdateSource>();
323
encDiagnosticsSource.ReportDiagnostics(testLspServer.
TestWorkspace
, testLspServer.
TestWorkspace
.CurrentSolution, ImmutableArray<DiagnosticData>.Empty, rudeEdits);
341
var buffer = testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
364
var buffer = testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
393
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
414
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
452
testLspServer.
TestWorkspace
.GetTestDocument(csproj1Document.Id).GetTextBuffer();
455
testLspServer.
TestWorkspace
.SetDocumentContext(csproj2Document.Id);
466
testLspServer.
TestWorkspace
.SetDocumentContext(csproj1Document.Id);
626
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
651
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
672
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
678
testLspServer.
TestWorkspace
.OnAnalyzerReferenceAdded(
703
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(FadingOptions.FadeOutUnusedImports, LanguageNames.CSharp, true);
742
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(FadingOptions.FadeOutUnusedImports, LanguageNames.CSharp, false);
883
testLspServer.
TestWorkspace
.GlobalOptions.SetGlobalOption(
1005
testLspServer.
TestWorkspace
.OnAnalyzerReferenceAdded(
1026
testLspServer.
TestWorkspace
.OnAnalyzerReferenceAdded(
1110
testLspServer.
TestWorkspace
.OnDocumentRemoved(testLspServer.
TestWorkspace
.Documents.First().Id);
1170
var buffer = testLspServer.
TestWorkspace
.Documents.First().GetTextBuffer();
1205
var buffer = testLspServer.
TestWorkspace
.Documents.First().GetTextBuffer();
1213
testLspServer.
TestWorkspace
.OnDocumentClosed(
1306
await testLspServer.
TestWorkspace
.ChangeDocumentAsync(csproj2Document.Id, newCsProj2Document.Project.Solution);
1381
await testLspServer.
TestWorkspace
.ChangeDocumentAsync(csproj3Document.Id, newCsProj3Document.Project.Solution).ConfigureAwait(false);
1448
await testLspServer.
TestWorkspace
.ChangeDocumentAsync(csproj2Document.Id, newCsProj2Document.Project.Solution);
1506
var projectInfo = testLspServer.
TestWorkspace
.Projects.Where(p => p.AssemblyName == "CSProj2").Single().ToProjectInfo();
1508
testLspServer.
TestWorkspace
.OnProjectReloaded(projectInfo);
1509
var operations = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<AsynchronousOperationListenerProvider>();
1561
var projectInfo = testLspServer.
TestWorkspace
.Projects.Where(p => p.AssemblyName == "CSProj2").Single().ToProjectInfo();
1562
testLspServer.
TestWorkspace
.OnProjectReloaded(projectInfo);
1563
var operations = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<AsynchronousOperationListenerProvider>();
1616
var projectInfo = testLspServer.
TestWorkspace
.Projects.Where(p => p.AssemblyName == "CSProj2").Single().ToProjectInfo();
1617
testLspServer.
TestWorkspace
.OnProjectReloaded(projectInfo);
1618
var operations = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<AsynchronousOperationListenerProvider>();
1701
var projectInfo = testLspServer.
TestWorkspace
.Projects.Single().ToProjectInfo();
1702
testLspServer.
TestWorkspace
.OnProjectReloaded(projectInfo);
Diagnostics\WorkspaceProjectDiagnosticsTests.cs (1)
59
await testLspServer.
TestWorkspace
.ChangeSolutionAsync(newSolution);
InlineCompletions\InlineCompletionsTests.cs (1)
254
var snippetParser = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<XmlSnippetParser>();
Miscellaneous\LspMiscellaneousFilesWorkspaceTests.cs (4)
64
testLspServer.
TestWorkspace
.GetService<LspWorkspaceRegistrationService>().Register(miscWorkspace);
163
testLspServer.
TestWorkspace
.OnDocumentAdded(documentInfo);
164
await WaitForWorkspaceOperationsAsync(testLspServer.
TestWorkspace
);
214
Assert.Equal(testLspServer.
TestWorkspace
, lspWorkspace);
Options\LspOptionsTests.cs (2)
37
var globalOptions = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<IGlobalOptionService>();
51
var globalOptions = testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<IGlobalOptionService>();
Ordering\RequestOrderingTests.cs (1)
212
testLspServer.
TestWorkspace
.SetCurrentSolution(s => s.WithProjectName(s.Projects.First().Id, "NewName"), WorkspaceChangeKind.ProjectChanged);
ProjectContext\GetTextDocumentWithContextHandlerTests.cs (2)
85
foreach (var document in testLspServer.
TestWorkspace
.Documents)
94
testLspServer.
TestWorkspace
.SetDocumentContext(project.DocumentIds.Single());
References\FindImplementationsTests.cs (1)
90
AddMappedDocument(testLspServer.
TestWorkspace
, markup);
Rename\RenameTests.cs (1)
167
AddMappedDocument(testLspServer.
TestWorkspace
, markup);
SpellCheck\SpellCheckTests.cs (26)
53
var testDocument = testLspServer.
TestWorkspace
.Documents.Single();
79
var workspace = testLspServer.
TestWorkspace
;
121
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
134
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.Single().AnnotatedSpans),
157
var buffer = testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
170
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.Single().AnnotatedSpans),
205
var buffer = testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
217
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.Single().AnnotatedSpans),
231
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.Single().AnnotatedSpans),
246
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
259
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.Single().AnnotatedSpans),
273
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
286
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.Single().AnnotatedSpans),
308
var document = testLspServer.
TestWorkspace
.CurrentSolution.Projects.Single().Documents.First();
314
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.First().AnnotatedSpans),
381
var document = testLspServer.
TestWorkspace
.CurrentSolution.Projects.Single().Documents.First();
387
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.First().AnnotatedSpans),
391
testLspServer.
TestWorkspace
.OnDocumentRemoved(testLspServer.
TestWorkspace
.Documents.First().Id);
419
var document = testLspServer.
TestWorkspace
.CurrentSolution.Projects.Single().Documents.First();
425
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.First().AnnotatedSpans),
455
var document = testLspServer.
TestWorkspace
.CurrentSolution.Projects.Single().Documents.First();
461
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.First().AnnotatedSpans),
465
var buffer = testLspServer.
TestWorkspace
.Documents.First().GetTextBuffer();
508
var document = testLspServer.
TestWorkspace
.CurrentSolution.Projects.Single().Documents.First();
514
Ranges = GetRanges(sourceText, testLspServer.
TestWorkspace
.Documents.First().AnnotatedSpans),
Workspaces\LspWorkspaceManagerTests.cs (33)
69
Assert.Same(testLspServer.
TestWorkspace
.CurrentSolution.GetDocument(firstDocument.Id), firstDocument);
70
Assert.Same(testLspServer.
TestWorkspace
.CurrentSolution.GetDocument(secondDocument.Id), secondDocument);
74
await testLspServer.
TestWorkspace
.ChangeDocumentAsync(firstDocument.Id, SourceText.From($"Some more text{markupOne}", System.Text.Encoding.UTF8, SourceHashAlgorithms.Default));
89
Assert.Equal(testLspServer.
TestWorkspace
.CurrentSolution.GetDocument(firstDocumentWithChange.Id), firstDocumentWithChange);
90
Assert.Equal(testLspServer.
TestWorkspace
.CurrentSolution.GetDocument(secondDocumentUnchanged.Id), secondDocumentUnchanged);
108
await testLspServer.
TestWorkspace
.ChangeDocumentAsync(secondDocument.Id, SourceText.From("Two is now three!", System.Text.Encoding.UTF8, SourceHashAlgorithms.Default));
119
Assert.NotEqual(testLspServer.
TestWorkspace
.CurrentSolution.GetDocument(secondDocument.Id), secondDocument);
132
Assert.Equal(testLspServer.
TestWorkspace
.CurrentSolution, openedDocument!.Project.Solution);
135
var newProject = testLspServer.
TestWorkspace
.CurrentSolution.Projects.First().WithAssemblyName("NewCSProj1");
136
await testLspServer.
TestWorkspace
.ChangeProjectAsync(newProject.Id, newProject.Solution);
143
Assert.Equal(testLspServer.
TestWorkspace
.CurrentSolution, openedDocument.Project.Solution);
156
Assert.NotEqual(testLspServer.
TestWorkspace
.CurrentSolution, openedDocument!.Project.Solution);
159
var newProject = testLspServer.
TestWorkspace
.CurrentSolution.Projects.First().WithAssemblyName("NewCSProj1");
160
await testLspServer.
TestWorkspace
.ChangeProjectAsync(newProject.Id, newProject.Solution);
167
Assert.NotEqual(testLspServer.
TestWorkspace
.CurrentSolution, openedDocument.Project.Solution);
181
var newDocumentId = DocumentId.CreateNewId(testLspServer.
TestWorkspace
.CurrentSolution.ProjectIds[0]);
182
var newSolution = testLspServer.
TestWorkspace
.CurrentSolution.AddDocument(newDocumentId, "NewDoc.cs", SourceText.From("New Doc", System.Text.Encoding.UTF8, SourceHashAlgorithms.Default), filePath: @"C:\NewDoc.cs");
184
await testLspServer.
TestWorkspace
.ChangeSolutionAsync(newSolution);
190
Assert.Equal(testLspServer.
TestWorkspace
.CurrentSolution, lspDocument.Project.Solution);
202
var newDocumentId = DocumentId.CreateNewId(testLspServer.
TestWorkspace
.CurrentSolution.ProjectIds[0]);
224
await testLspServer.
TestWorkspace
.AddDocumentAsync(newDocumentInfo);
229
Assert.Equal(testLspServer.
TestWorkspace
, documentWorkspace);
255
Assert.True(IsWorkspaceRegistered(testLspServer.
TestWorkspace
, testLspServer));
260
composition: testLspServer.
TestWorkspace
.Composition);
266
var workspaceRegistrationService = testLspServer.
TestWorkspace
.GetService<LspWorkspaceRegistrationService>();
270
Assert.True(IsWorkspaceRegistered(testLspServer.
TestWorkspace
, testLspServer));
290
var exportProvider = testLspServer.
TestWorkspace
.ExportProvider;
296
Assert.True(IsWorkspaceRegistered(testLspServer.
TestWorkspace
, testLspServer));
329
Assert.True(IsWorkspaceRegistered(testLspServer.
TestWorkspace
, testLspServer));
340
Assert.Equal(testLspServer.
TestWorkspace
, firstWorkspace);
395
Assert.Equal(testLspServer.
TestWorkspace
, firstWorkspace);
473
testLspServer.
TestWorkspace
.Documents.Single().GetTextBuffer();
481
Assert.Same(testLspServer.
TestWorkspace
.CurrentSolution, lspDocument.Project.Solution);
Workspaces\LspWorkspaceRegistrationServiceTests.cs (1)
29
registrationService = (TestWorkspaceRegistrationService)testLspServer.
TestWorkspace
.ExportProvider.GetExportedValue<LspWorkspaceRegistrationService>();