Forge
csharpdeeb25a2
1using CascadeIDE.Features.UiChrome;
2using CascadeIDE.Features.Workspace;
3using CascadeIDE.Services;
4using Xunit;
5
6namespace CascadeIDE.Tests;
7
8/// <summary>
9/// Репозиторный bundle <c>UiModes/workspace.toml</c> содержит все канонические intent-id (ADR 0051) —
10/// иначе дефолты в коде и TOML разъедутся без явной ошибки.
11/// </summary>
12public sealed class UiModesWorkspaceBundleRoutingTests
13{
14 static string RepoRoot()
15 {
16 var dir = new DirectoryInfo(AppContext.BaseDirectory);
17 while (dir is not null)
18 {
19 if (File.Exists(Path.Combine(dir.FullName, "CascadeIDE.sln")))
20 return dir.FullName;
21 dir = dir.Parent;
22 }
23
24 throw new InvalidOperationException("CascadeIDE.sln not found from test output path.");
25 }
26
27 [Fact]
28 public void Bundle_workspace_toml_maps_all_AttentionRoutingIntentIds()
29 {
30 var path = Path.Combine(RepoRoot(), "UiModes", "workspace.toml");
31 Assert.True(File.Exists(path), $"Missing {path}");
32
33 var text = File.ReadAllText(path);
34 var w = CascadeTomlSerializer.Deserialize<RepositoryWorkspaceToml>(text);
35 Assert.NotNull(w?.Routing?.Attention);
36
37 foreach (var intent in new[]
38 {
39 AttentionRoutingIntentIds.SolutionExplorer,
40 AttentionRoutingIntentIds.Chat,
41 AttentionRoutingIntentIds.Git,
42 AttentionRoutingIntentIds.Terminal,
43 AttentionRoutingIntentIds.Editor,
44 })
45 {
46 Assert.True(
47 w!.Routing!.Attention!.ContainsKey(intent),
48 $"UiModes/workspace.toml [routing.attention] should define intent '{intent}'.");
49 }
50 }
51}
52
View only · write via MCP/CIDE