4fceda163d
* Improve background refresh and process detection * Harden affinity and power plan automation * Fix passive process refresh failures * Improve UX terminology and process layout * Polish UX layout and empty states * Expand core service test coverage
45 lines
2.0 KiB
C#
45 lines
2.0 KiB
C#
namespace ThreadPilot.Core.Tests
|
|
{
|
|
using ThreadPilot.Services;
|
|
|
|
public sealed class AppRefreshPolicyTests
|
|
{
|
|
[Theory]
|
|
[InlineData(AppActivityState.ForegroundProcessView, true, true, true, true, true, true)]
|
|
[InlineData(AppActivityState.ForegroundOtherTab, false, false, false, true, true, true)]
|
|
[InlineData(AppActivityState.Minimized, false, false, false, false, false, true)]
|
|
[InlineData(AppActivityState.TrayHidden, false, false, false, false, false, true)]
|
|
public void Evaluate_ReturnsExpectedRefreshDecision(
|
|
AppActivityState state,
|
|
bool processUiRefreshEnabled,
|
|
bool immediateProcessRefresh,
|
|
bool virtualizedPreloadEnabled,
|
|
bool performanceUiMonitoringEnabled,
|
|
bool powerPlanUiRefreshEnabled,
|
|
bool backgroundAutomationEnabled)
|
|
{
|
|
var decision = AppRefreshPolicy.Evaluate(state);
|
|
|
|
Assert.Equal(processUiRefreshEnabled, decision.ProcessUiRefreshEnabled);
|
|
Assert.Equal(immediateProcessRefresh, decision.ImmediateProcessRefresh);
|
|
Assert.Equal(virtualizedPreloadEnabled, decision.VirtualizedPreloadEnabled);
|
|
Assert.Equal(performanceUiMonitoringEnabled, decision.PerformanceUiMonitoringEnabled);
|
|
Assert.Equal(powerPlanUiRefreshEnabled, decision.PowerPlanUiRefreshEnabled);
|
|
Assert.Equal(backgroundAutomationEnabled, decision.BackgroundAutomationEnabled);
|
|
}
|
|
|
|
[Fact]
|
|
public void Evaluate_WhenStateIsUnknown_KeepsBackgroundAutomationOnly()
|
|
{
|
|
var decision = AppRefreshPolicy.Evaluate((AppActivityState)999);
|
|
|
|
Assert.False(decision.ProcessUiRefreshEnabled);
|
|
Assert.False(decision.ImmediateProcessRefresh);
|
|
Assert.False(decision.VirtualizedPreloadEnabled);
|
|
Assert.False(decision.PerformanceUiMonitoringEnabled);
|
|
Assert.False(decision.PowerPlanUiRefreshEnabled);
|
|
Assert.True(decision.BackgroundAutomationEnabled);
|
|
}
|
|
}
|
|
}
|