| 1 | using CascadeIDE.Features.Shell.Application; |
| 2 | using CascadeIDE.Models; |
| 3 | using Xunit; |
| 4 | |
| 5 | namespace CascadeIDE.Tests; |
| 6 | |
| 7 | public sealed class MfdShellPageAllowanceProjectionTests |
| 8 | { |
| 9 | private static readonly MfdShellPageAllowanceProjection.Snapshot AllDenied = new( |
| 10 | ShowIdeHealthMfdPage: false, |
| 11 | IsDockedMfdSolutionExplorerTree: false, |
| 12 | IsTerminalVisible: false, |
| 13 | IsBuildOutputVisible: false, |
| 14 | IsProblemsPanelVisible: false, |
| 15 | IsGitPanelVisible: false, |
| 16 | InstrumentationTabs: false, |
| 17 | HypothesesTab: false, |
| 18 | IsIntercomPrimaryWorkSurface: false); |
| 19 | |
| 20 | [Fact] |
| 21 | public void Core_pages_still_blocked_when_snapshot_denies() |
| 22 | { |
| 23 | Assert.False(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.WorkspaceHealth, AllDenied)); |
| 24 | Assert.False(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.SolutionExplorer, AllDenied)); |
| 25 | Assert.False(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.Terminal, AllDenied)); |
| 26 | } |
| 27 | |
| 28 | [Fact] |
| 29 | public void Related_related_markdown_indexes_always_allowed() |
| 30 | { |
| 31 | Assert.True(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.RelatedFiles, AllDenied)); |
| 32 | Assert.True(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.Correspondence, AllDenied)); |
| 33 | Assert.True(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.HybridIndex, AllDenied)); |
| 34 | Assert.True(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.WebAiPortal, AllDenied)); |
| 35 | } |
| 36 | |
| 37 | [Fact] |
| 38 | public void First_allowed_follows_page_order_among_neutral_surfaces() |
| 39 | { |
| 40 | // Related/Markdown/Hybrid/Chat/… остаются разрешёнными независимо от флагов доков. |
| 41 | Assert.Equal(MfdShellPage.RelatedFiles, MfdShellPageAllowanceProjection.FirstAllowedOrChat(AllDenied)); |
| 42 | } |
| 43 | |
| 44 | [Fact] |
| 45 | public void Terminal_allowed_when_visibility_flag() |
| 46 | { |
| 47 | var on = AllDenied with { IsTerminalVisible = true }; |
| 48 | Assert.True(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.Terminal, on)); |
| 49 | } |
| 50 | |
| 51 | [Fact] |
| 52 | public void Intercom_primary_swaps_editor_and_chat_mfd_pages() |
| 53 | { |
| 54 | var intercom = AllDenied with { IsIntercomPrimaryWorkSurface = true }; |
| 55 | Assert.True(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.Editor, intercom)); |
| 56 | Assert.False(MfdShellPageAllowanceProjection.IsAllowed(MfdShellPage.Chat, intercom)); |
| 57 | } |
| 58 | } |
| 59 | |