Forge
csharpdeeb25a2
1using CascadeIDE.Features.Chat;
2using CascadeIDE.Services;
3using Xunit;
4
5namespace CascadeIDE.Tests;
6
7/// <summary>ADR 0150: резолв по longest catalog path, не только parser head/action.</summary>
8public sealed class ChatSlashCatalogPathResolveTests
9{
10 [Theory]
11 [InlineData("/map type file", "/map type file", IdeCommands.SetCodeNavigationMapLevel, "file")]
12 [InlineData("/map type controlflow", "/map type controlflow", IdeCommands.SetCodeNavigationMapLevel, "controlFlow")]
13 [InlineData("/solution explorer show", "/solution explorer show", IdeCommands.ShowSolutionExplorerPage, null)]
14 public void TryResolveInput_threeTokenCatalogPaths(
15 string line,
16 string expectedPath,
17 string expectedCommandId,
18 string? expectedMapLevel)
19 {
20 Assert.True(ChatSlashCommandCatalog.TryResolveInput(line, out var descriptor, out _));
21 Assert.Equal(expectedPath, descriptor.SlashPath);
22 Assert.Equal(expectedCommandId, descriptor.CommandId);
23 Assert.Equal(expectedMapLevel, descriptor.MapLevel);
24 }
25
26 [Fact]
27 public void TryResolveCanonical_doesNotDependOnParserShape()
28 {
29 Assert.True(ChatSlashCommandCatalog.TryResolveCanonical("/map type file", "", out var descriptor));
30 Assert.Equal(IdeCommands.SetCodeNavigationMapLevel, descriptor.CommandId);
31 Assert.Equal("file", descriptor.MapLevel);
32 }
33
34 [Fact]
35 public void SlashLineResolver_mapTypeFile_isRunnable()
36 {
37 Assert.True(SlashLineResolver.TryResolveSlashLine("/map type file", out var line));
38 Assert.Equal("/map type file", line.CanonicalPath);
39 Assert.True(line.IsRunnable);
40 }
41}
42
View only · write via MCP/CIDE