| 1 | using CascadeIDE.Cockpit.ComputingUnits.IdeHealth; |
| 2 | using Xunit; |
| 3 | |
| 4 | namespace CascadeIDE.Tests; |
| 5 | |
| 6 | public sealed class IdeHealthScopeDecisionUnitTests |
| 7 | { |
| 8 | [Fact] |
| 9 | public void Decide_returns_solution_scope_without_startup_project() |
| 10 | { |
| 11 | var decision = IdeHealthScopeDecisionUnit.Default.Decide( |
| 12 | startupProjectPath: null, |
| 13 | isBuilding: true, |
| 14 | lastTestSummary: "5/5 passed"); |
| 15 | |
| 16 | Assert.Equal(IdeHealthScope.Solution, decision.Scope); |
| 17 | Assert.Null(decision.ProjectPath); |
| 18 | } |
| 19 | |
| 20 | [Fact] |
| 21 | public void Decide_returns_solution_scope_without_build_or_tests_signal() |
| 22 | { |
| 23 | var decision = IdeHealthScopeDecisionUnit.Default.Decide( |
| 24 | startupProjectPath: "src/App/App.csproj", |
| 25 | isBuilding: false, |
| 26 | lastTestSummary: ""); |
| 27 | |
| 28 | Assert.Equal(IdeHealthScope.Solution, decision.Scope); |
| 29 | Assert.Null(decision.ProjectPath); |
| 30 | } |
| 31 | |
| 32 | [Fact] |
| 33 | public void Decide_returns_project_scope_when_startup_project_and_signal_exist() |
| 34 | { |
| 35 | var decision = IdeHealthScopeDecisionUnit.Default.Decide( |
| 36 | startupProjectPath: "src/App/App.csproj", |
| 37 | isBuilding: false, |
| 38 | lastTestSummary: "12/12 passed"); |
| 39 | |
| 40 | Assert.Equal(IdeHealthScope.Project, decision.Scope); |
| 41 | Assert.Equal("src/App/App.csproj", decision.ProjectPath); |
| 42 | } |
| 43 | } |
| 44 | |