csharpdeeb25a2 | 1 | using System.Text.Json; |
| 2 | using CascadeIDE.Services.Lsp; |
| 3 | using Xunit; |
| 4 | |
| 5 | namespace CascadeIDE.Tests; |
| 6 | |
| 7 | public class LspHoverContentFormatterTests |
| 8 | { |
| 9 | [Fact] |
| 10 | public void Format_String_ReturnsLiteral() |
| 11 | { |
| 12 | using var doc = JsonDocument.Parse("\"hello\""); |
| 13 | var s = LspHoverContentFormatter.Format(doc.RootElement); |
| 14 | Assert.Equal("hello", s); |
| 15 | } |
| 16 | |
| 17 | [Fact] |
| 18 | public void Format_MarkupContent_ReturnsValue() |
| 19 | { |
| 20 | using var doc = JsonDocument.Parse("""{"kind":"markdown","value":"Line1"}"""); |
| 21 | var s = LspHoverContentFormatter.Format(doc.RootElement); |
| 22 | Assert.Equal("Line1", s); |
| 23 | } |
| 24 | |
| 25 | [Fact] |
| 26 | public void Format_Array_JoinsMarkedStrings() |
| 27 | { |
| 28 | using var doc = JsonDocument.Parse("""[{"language":"csharp","value":"a"},{"value":"b"}]"""); |
| 29 | var s = LspHoverContentFormatter.Format(doc.RootElement); |
| 30 | Assert.Contains("a", s, StringComparison.Ordinal); |
| 31 | Assert.Contains("b", s, StringComparison.Ordinal); |
| 32 | } |
| 33 | } |
| 34 | |
View only · write via MCP/CIDE