Forge
csharpdeeb25a2
1using CascadeIDE.Cockpit.Channels.TraceFlow;
2using CascadeIDE.Cockpit.Graph;
3using CascadeIDE.Services;
4using Xunit;
5
6namespace CascadeIDE.Tests;
7
8public sealed class TraceFlowChannelCoordinatorTests
9{
10 [Fact]
11 public void Build_MergesSnapshotsFromMultipleChannels()
12 {
13 var doc = new GraphDocument
14 {
15 AnchorPath = @"D:\w\A.cs",
16 Nodes =
17 [
18 Node("n0", "anchor"),
19 Node("n1", "condition_step"),
20 Node("n2", "exit_step"),
21 Node("n3", "call_step")
22 ],
23 Edges =
24 [
25 Edge("n0", "n1", "ConditionalCall"),
26 Edge("n1", "n2", "Exit"),
27 Edge("n1", "n3", "Call")
28 ]
29 };
30
31 var coordinator = new TraceFlowChannelCoordinator(
32 [
33 new CodeFlowTraceChannel(),
34 new UnitTestTraceChannel()
35 ]);
36 var snapshot = coordinator.Build(new TraceFlowChannelContext(doc, ImpactedTestsBadge: 1, LastTestSummary: "1 failed"));
37
38 Assert.Contains("n0->n1", snapshot.HighlightedEdgeKeys); // from code-flow
39 Assert.Contains("n1->n2", snapshot.HighlightedEdgeKeys); // from unit-test
40 Assert.Contains("n2", snapshot.HighlightedNodeIds); // exit emphasis
41 }
42
43 private static GraphNode Node(string id, string kind) => new()
44 {
45 Id = id,
46 Path = @"D:\w\A.cs",
47 Kind = kind,
48 Label = id
49 };
50
51 private static GraphEdge Edge(string from, string to, string kind) => new()
52 {
53 FromId = from,
54 ToId = to,
55 Kind = kind,
56 RelationKind = kind
57 };
58}
59
View only · write via MCP/CIDE