| 1 | using CascadeIDE.Cockpit.ComputingUnits.IdeHealth; |
| 2 | using CascadeIDE.Features.Shell.Application; |
| 3 | using Xunit; |
| 4 | |
| 5 | namespace CascadeIDE.Tests; |
| 6 | |
| 7 | public sealed class IdeHealthStripPresentationProjectionTests |
| 8 | { |
| 9 | private static IdeHealthInputSnapshot Snapshot() |
| 10 | => IdeHealthInputSnapshot.FromFlat( |
| 11 | build: new IdeHealthSegmentInput("build-line", "B"), |
| 12 | tests: new IdeHealthSegmentInput("tests-line", "T"), |
| 13 | debug: new IdeHealthSegmentInput("debug-line", "D"), |
| 14 | git: new IdeHealthSegmentInput("git-line", "G")); |
| 15 | |
| 16 | [Fact] |
| 17 | public void Nullable_snapshot_returns_empty_strings() |
| 18 | { |
| 19 | IdeHealthInputSnapshot? nullSnap = null; |
| 20 | Assert.Equal("", IdeHealthStripPresentationProjection.SolutionBuildLineText(nullSnap)); |
| 21 | Assert.Equal("", IdeHealthStripPresentationProjection.SolutionBuildCockpitShort(nullSnap)); |
| 22 | Assert.Equal("", IdeHealthStripPresentationProjection.SolutionTestsLineText(nullSnap)); |
| 23 | Assert.Equal("", IdeHealthStripPresentationProjection.SolutionTestsCockpitShort(nullSnap)); |
| 24 | Assert.Equal("", IdeHealthStripPresentationProjection.SolutionDebugLineText(nullSnap)); |
| 25 | Assert.Equal("", IdeHealthStripPresentationProjection.SolutionDebugCockpitShort(nullSnap)); |
| 26 | } |
| 27 | |
| 28 | [Fact] |
| 29 | public void Snapshotted_solution_segments_project_line_and_short() |
| 30 | { |
| 31 | var s = Snapshot(); |
| 32 | Assert.Equal("build-line", IdeHealthStripPresentationProjection.SolutionBuildLineText(s)); |
| 33 | Assert.Equal("B", IdeHealthStripPresentationProjection.SolutionBuildCockpitShort(s)); |
| 34 | Assert.Equal("tests-line", IdeHealthStripPresentationProjection.SolutionTestsLineText(s)); |
| 35 | Assert.Equal("T", IdeHealthStripPresentationProjection.SolutionTestsCockpitShort(s)); |
| 36 | Assert.Equal("debug-line", IdeHealthStripPresentationProjection.SolutionDebugLineText(s)); |
| 37 | Assert.Equal("D", IdeHealthStripPresentationProjection.SolutionDebugCockpitShort(s)); |
| 38 | } |
| 39 | } |
| 40 | |