| 1 | using CascadeIDE.Features.Settings.DataAcquisition; |
| 2 | using CascadeIDE.Features.Workspace.Application; |
| 3 | using CascadeIDE.Models; |
| 4 | using CascadeIDE.Services; |
| 5 | using Xunit; |
| 6 | |
| 7 | namespace CascadeIDE.Tests; |
| 8 | |
| 9 | public sealed class SolutionExplorerMlpTests |
| 10 | { |
| 11 | [Theory] |
| 12 | [InlineData("file_csproj", "csproj")] |
| 13 | [InlineData("file_fsproj", "fsproj")] |
| 14 | [InlineData("file_vbproj", "vbproj")] |
| 15 | [InlineData("file_cs", "cs")] |
| 16 | [InlineData("file_axaml", "axaml")] |
| 17 | [InlineData("file_toml", "toml")] |
| 18 | [InlineData("file_md", "md")] |
| 19 | public void IconKeys_MapCommonExtensions(string iconKey, string expected) => |
| 20 | Assert.Equal(expected, SolutionExplorerIconKeys.ResolveAssetName(iconKey)); |
| 21 | |
| 22 | [Fact] |
| 23 | public void IconKeys_PowerMode_UsesSameVscodeIconsSubset() |
| 24 | { |
| 25 | Assert.Equal("cs", SolutionExplorerIconKeys.ResolveAssetName("file_cs", powerMonochrome: true)); |
| 26 | Assert.Equal("axaml", SolutionExplorerIconKeys.ResolveAssetName("file_axaml", powerMonochrome: true)); |
| 27 | Assert.Equal("csproj", SolutionExplorerIconKeys.ResolveAssetName("file_csproj", powerMonochrome: true)); |
| 28 | } |
| 29 | |
| 30 | [Fact] |
| 31 | public void SolutionItem_CsprojIconKey_IsLanguageSpecific() |
| 32 | { |
| 33 | var item = SolutionItem.CreateProject("P", @"C:\ws\P\P.csproj"); |
| 34 | Assert.Equal("file_csproj", item.IconKey); |
| 35 | } |
| 36 | |
| 37 | [Fact] |
| 38 | public void Deserialize_WorkspaceSolutionExplorer_ParsesToggles() |
| 39 | { |
| 40 | const string text = |
| 41 | """ |
| 42 | [workspace.solution_explorer] |
| 43 | track_active_item = false |
| 44 | compact_tree = false |
| 45 | """; |
| 46 | |
| 47 | var settings = CascadeTomlSerializer.Deserialize<CascadeIdeSettings>(text); |
| 48 | Assert.NotNull(settings); |
| 49 | Assert.False(settings!.Workspace.SolutionExplorer.TrackActiveItem); |
| 50 | Assert.False(settings.Workspace.SolutionExplorer.CompactTree); |
| 51 | } |
| 52 | |
| 53 | [Fact] |
| 54 | public void HotkeysToml_ContainsSolutionExplorerFilterShortcut() |
| 55 | { |
| 56 | Assert.True( |
| 57 | BundledAppContent.TryReadDiskThenEmbedded("Hotkeys/hotkeys.toml", out var hotkeyText)); |
| 58 | Assert.Contains("focus_solution_explorer_filter", hotkeyText!, StringComparison.Ordinal); |
| 59 | Assert.Contains("Ctrl+Oem1", hotkeyText!, StringComparison.Ordinal); |
| 60 | } |
| 61 | |
| 62 | [Fact] |
| 63 | public void WindowsShellReveal_ReturnsFalseForMissingPath() => |
| 64 | Assert.False(WindowsShellReveal.TryRevealInExplorer(@"C:\no-such-path-0167\missing.cs")); |
| 65 | } |
| 66 | |