Description
Two critical helper classes are entirely static with no interfaces:
ProcessHelper (src/Servy.Core/Helpers/ProcessHelper.cs)
GetCpuUsage(int pid), GetRamUsage(int pid), ResolvePath(), ValidatePath(), FormatCpuUsage(), FormatRamUsage()
- Called from
MainViewModel.RefreshServiceInternal (lines 900–901) and PerformanceViewModel.OnTickAsync (lines 310–313)
- Tests must deal with real
Process.GetProcessById calls
ProcessKiller (src/Servy.Core/Helpers/ProcessKiller.cs)
KillProcessesUsingFile(), KillProcessTreeAndParents()
- Called from MainWindow cleanup and ResourceHelper
- Tests cannot verify process-killing behavior
Impact
Any test of refresh, performance, or cleanup logic requires real process handles. Cannot verify behavior with specific PIDs, failure scenarios, or access-denied conditions.
Suggested fix
Wrap behind interfaces (IProcessHelper, IProcessKiller) and inject. The existing code uses instance-based DI for most other services — these two are the main holdouts.
Description
Two critical helper classes are entirely static with no interfaces:
ProcessHelper (
src/Servy.Core/Helpers/ProcessHelper.cs)GetCpuUsage(int pid),GetRamUsage(int pid),ResolvePath(),ValidatePath(),FormatCpuUsage(),FormatRamUsage()MainViewModel.RefreshServiceInternal(lines 900–901) andPerformanceViewModel.OnTickAsync(lines 310–313)Process.GetProcessByIdcallsProcessKiller (
src/Servy.Core/Helpers/ProcessKiller.cs)KillProcessesUsingFile(),KillProcessTreeAndParents()Impact
Any test of refresh, performance, or cleanup logic requires real process handles. Cannot verify behavior with specific PIDs, failure scenarios, or access-denied conditions.
Suggested fix
Wrap behind interfaces (
IProcessHelper,IProcessKiller) and inject. The existing code uses instance-based DI for most other services — these two are the main holdouts.