/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/LanguageServer/ProtocolUnitTests/Options/LspOptionsTests.cs
44 строки
2 KB
David Barbet
Refactor LSP server logging to remove singleton lsp instance (#84001)
16 июн 2026, 05:04
Не верифицирован
16 июн 2026, 05:04
82e81e5
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.AddImport; using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Simplification; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Options.UnitTests; public sealed class LspOptionsTests(ITestOutputHelper testOutputHelper) : AbstractLanguageServerProtocolTests(testOutputHelper) { [Theory, CombinatorialData] public async Task TestCanRetrieveCSharpOptionsWithOnlyLspLayer(bool mutatingLspWorkspace) { var markup = ""; await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace); var globalOptions = testLspServer.TestWorkspace.ExportProvider.GetExportedValue<IGlobalOptionService>(); var project = testLspServer.GetCurrentSolution().Projects.Single().Services; Assert.NotNull(globalOptions.GetAddImportPlacementOptions(project, allowInHiddenRegions: null)); Assert.NotNull(globalOptions.GetCodeGenerationOptions(project)); Assert.NotNull(globalOptions.GetSyntaxFormattingOptions(project)); Assert.NotNull(globalOptions.GetSimplifierOptions(project)); } [Theory, CombinatorialData] public async Task TestCanRetrieveVisualBasicOptionsWithOnlyLspLayer(bool mutatingLspWorkspace) { var markup = ""; await using var testLspServer = await CreateVisualBasicTestLspServerAsync(markup, mutatingLspWorkspace); var globalOptions = testLspServer.TestWorkspace.ExportProvider.GetExportedValue<IGlobalOptionService>(); var project = testLspServer.GetCurrentSolution().Projects.Single().Services; Assert.NotNull(globalOptions.GetAddImportPlacementOptions(project, allowInHiddenRegions: null)); Assert.NotNull(globalOptions.GetCodeGenerationOptions(project)); Assert.NotNull(globalOptions.GetSyntaxFormattingOptions(project)); Assert.NotNull(globalOptions.GetSimplifierOptions(project)); } }