| 1 | using CascadeIDE.Cockpit.Graph; |
| 2 | using CascadeIDE.Models; |
| 3 | using CascadeIDE.Services.Navigation; |
| 4 | using CascadeIDE.ViewModels; |
| 5 | using Xunit; |
| 6 | |
| 7 | namespace CascadeIDE.Tests; |
| 8 | |
| 9 | public sealed class CodeNavigationMapPresentationResolverTests |
| 10 | { |
| 11 | [Fact] |
| 12 | public void Resolve_Unspecified_UsesLevelControlFlow() |
| 13 | { |
| 14 | var doc = new GraphDocument |
| 15 | { |
| 16 | AnchorPath = @"D:\a.cs", |
| 17 | Nodes = [], |
| 18 | Edges = [], |
| 19 | Kind = GraphKind.Unspecified |
| 20 | }; |
| 21 | var p = CodeNavigationMapPresentationResolver.Resolve(doc, CodeNavigationMapLevelKind.ControlFlow); |
| 22 | Assert.Equal(CodeNavigationMapGraphPresentationKind.CodeControlFlow, p); |
| 23 | } |
| 24 | |
| 25 | [Fact] |
| 26 | public void Resolve_Unspecified_UsesLevelFile() |
| 27 | { |
| 28 | var doc = new GraphDocument |
| 29 | { |
| 30 | AnchorPath = @"D:\a.cs", |
| 31 | Nodes = [], |
| 32 | Edges = [], |
| 33 | Kind = GraphKind.Unspecified |
| 34 | }; |
| 35 | var p = CodeNavigationMapPresentationResolver.Resolve(doc, CodeNavigationMapLevelKind.File); |
| 36 | Assert.Equal(CodeNavigationMapGraphPresentationKind.WorkspaceRelatedFiles, p); |
| 37 | } |
| 38 | |
| 39 | [Fact] |
| 40 | public void Resolve_ExplicitGraphKind_OverridesLevel() |
| 41 | { |
| 42 | var doc = new GraphDocument |
| 43 | { |
| 44 | AnchorPath = @"D:\a.cs", |
| 45 | Nodes = [], |
| 46 | Edges = [], |
| 47 | Kind = GraphKind.CodeIntent |
| 48 | }; |
| 49 | var p = CodeNavigationMapPresentationResolver.Resolve(doc, CodeNavigationMapLevelKind.File); |
| 50 | Assert.Equal(CodeNavigationMapGraphPresentationKind.CodeControlFlow, p); |
| 51 | } |
| 52 | } |
| 53 | |