Forge
csharpdeeb25a2
1using System.IO;
2using CascadeIDE.Features.WorkspaceNavigation.Application;
3using CascadeIDE.Models;
4using CascadeIDE.Services;
5using Xunit;
6
7namespace CascadeIDE.Tests;
8
9public sealed class WorkspaceNavigationMapOrchestratorNavigationPathTests
10{
11 [Fact]
12 public void ResolveNavigationPathForGraphJson_ControlFlow_prefers_current_cs_when_in_solution_files()
13 {
14 var foo = Path.Combine(Path.GetTempPath(), "cf-nav-prefers-current", "Foo.cs");
15 var other = Path.Combine(Path.GetTempPath(), "cf-nav-prefers-current", "Other.cs");
16 var list = new[] { foo, other };
17
18 var p = WorkspaceNavigationMapOrchestrator.ResolveNavigationPathForGraphJson(
19 CodeNavigationMapLevelKind.ControlFlow,
20 foo,
21 other,
22 list);
23
24 Assert.True(EditorTextCoordinateUtilities.PathsReferToSameFile(p!, foo));
25 }
26
27 [Fact]
28 public void ResolveNavigationPathForGraphJson_ControlFlow_uses_active_cs_when_not_tracked_like_solution_members()
29 {
30 var current = @"C:\workspace\Experimental\Sandbox.cs";
31
32 var p = WorkspaceNavigationMapOrchestrator.ResolveNavigationPathForGraphJson(
33 CodeNavigationMapLevelKind.ControlFlow,
34 current,
35 @"C:\workspace\Legacy\Program.cs",
36 []);
37
38 Assert.Equal(current, p);
39 }
40
41 [Fact]
42 public void ResolveNavigationPathForGraphJson_File_level_keeps_fallback_order()
43 {
44 var list = new[] { @"D:\a\X.cs" };
45 var p = WorkspaceNavigationMapOrchestrator.ResolveNavigationPathForGraphJson(
46 CodeNavigationMapLevelKind.File,
47 @"D:\a\Y.cs",
48 @"D:\a\X.cs",
49 list);
50 Assert.Equal(@"D:\a\X.cs", p);
51 }
52}
53
View only · write via MCP/CIDE