diff --git a/tests/CSharpLanguageServer.Tests/InitializationTests.fs b/tests/CSharpLanguageServer.Tests/InitializationTests.fs index 2f5b0883..213cf4ae 100644 --- a/tests/CSharpLanguageServer.Tests/InitializationTests.fs +++ b/tests/CSharpLanguageServer.Tests/InitializationTests.fs @@ -116,3 +116,35 @@ let testServerRegistersCapabilitiesWithTheClient () = Assert.IsTrue(client.ServerDidRespondTo("initialize")) Assert.IsTrue(client.ServerDidRespondTo("initialized")) + + +[] +let testMultiTargetProjectLoads () = + use client = setupServerClient { defaultClientProfile with LoggingEnabled=true } + "TestData/testMultiTargetProjectLoads" + client.StartAndWaitForSolutionLoad() + + use classFile = client.Open("Project/Class.cs") + + let hover0Params: HoverParams = + { TextDocument = { Uri = classFile.Uri } + Position = { Line = 2u; Character = 16u } + WorkDoneToken = None + } + + let hover0: Hover option = + client.Request("textDocument/hover", hover0Params) + + match hover0 with + | Some hover -> + match hover.Contents with + | U3.C1 c -> + Assert.AreEqual(MarkupKind.Markdown, c.Kind) + Assert.AreEqual("`` void Class.Method(string arg) ``", c.Value) + | _ -> failwith "C1 was expected" + + Assert.IsTrue(hover.Range.IsNone) + + | x -> failwithf "Some (U3.C1 c) was expected but '%s' received" (string x) + + Assert.IsTrue(false) diff --git a/tests/CSharpLanguageServer.Tests/TestData/testMultiTargetProjectLoads/Project/Class.cs b/tests/CSharpLanguageServer.Tests/TestData/testMultiTargetProjectLoads/Project/Class.cs new file mode 100644 index 00000000..b0339d85 --- /dev/null +++ b/tests/CSharpLanguageServer.Tests/TestData/testMultiTargetProjectLoads/Project/Class.cs @@ -0,0 +1,6 @@ +class Class +{ + public void Method(string arg) + { + } +} diff --git a/tests/CSharpLanguageServer.Tests/TestData/testMultiTargetProjectLoads/Project/Project.csproj b/tests/CSharpLanguageServer.Tests/TestData/testMultiTargetProjectLoads/Project/Project.csproj new file mode 100644 index 00000000..5300706a --- /dev/null +++ b/tests/CSharpLanguageServer.Tests/TestData/testMultiTargetProjectLoads/Project/Project.csproj @@ -0,0 +1,6 @@ + + + Exe + net6.0;net8.0 + +