9f56303e93
Improve affinity errors and priority guardrails Centralize safe user-facing messages for process affinity, CPU Sets, protected processes, access denied cases, topology errors and priority guardrails. - Add CpuSetApplyResult detailed path while preserving existing bool CPU Sets APIs - Use detailed CPU Sets results in the CpuSelection affinity flow - Centralize affinity/priority messages in ProcessOperationUserMessages - Improve AccessDenied, anti-cheat/protected, invalid topology, process exited and legacy fallback blocked messages - Add High priority warning - Block Realtime priority for direct apply, profile load and registry priority requests - Audit and log blocked Realtime priority attempts - Prevent critical status messages from being cleared immediately - Add tests for affinity messages, CPU Sets detailed failures, priority guardrails and status clearing No persistent rules engine, registry affinity, preset/profile migration, version or tag changes.
33 lines
907 B
C#
33 lines
907 B
C#
namespace ThreadPilot.Core.Tests
|
|
{
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using ThreadPilot.ViewModels;
|
|
|
|
public sealed class BaseViewModelStatusTests
|
|
{
|
|
[Fact]
|
|
public void ClearStatus_DoesNotClearCriticalStatus()
|
|
{
|
|
var viewModel = new TestViewModel();
|
|
|
|
viewModel.SetCritical("Realtime priority is blocked.");
|
|
viewModel.Clear();
|
|
|
|
Assert.Equal("Realtime priority is blocked.", viewModel.StatusMessage);
|
|
Assert.False(viewModel.IsBusy);
|
|
}
|
|
|
|
private sealed class TestViewModel : BaseViewModel
|
|
{
|
|
public TestViewModel()
|
|
: base(NullLogger<TestViewModel>.Instance)
|
|
{
|
|
}
|
|
|
|
public void SetCritical(string message) => this.SetCriticalStatus(message);
|
|
|
|
public void Clear() => this.ClearStatus();
|
|
}
|
|
}
|
|
}
|