Files
ThreadPilot/Tests/ThreadPilot.Core.Tests/ProcessPowerPlanAssociationTests.cs
Seyedamin Mousavichashmi c6f74a948f feat: support wildcard executable paths (#63)
Support case-insensitive * and ? matching for persistent process rules and power-plan associations while preserving exact-path behavior.
2026-09-29 22:13:42 +02:00

34 lines
1.0 KiB
C#

/*
* ThreadPilot - process power plan association tests.
*/
namespace ThreadPilot.Core.Tests
{
using ThreadPilot.Models;
public sealed class ProcessPowerPlanAssociationTests
{
[Fact]
public void MatchesProcess_WithWildcardPath_MatchesOnlyTargetPath()
{
var association = new ProcessPowerPlanAssociation
{
IsEnabled = true,
MatchByPath = true,
ExecutableName = "node",
ExecutablePath = @"*Raycast*\backend\node.exe",
};
Assert.True(association.MatchesProcess(new ProcessModel
{
Name = "node.exe",
ExecutablePath = @"C:\Program Files\WindowsApps\Raycast.Raycast_2.5.3.0_x64__publisher\Raycast\backend\NODE.EXE",
}));
Assert.False(association.MatchesProcess(new ProcessModel
{
Name = "node.exe",
ExecutablePath = @"C:\nvm4w\nodejs\node.exe",
}));
}
}
}