コード例 #1
0
        public void KillProcessAlreadyExited()
        {
            Process process = SpawnTestProcesses(1)[0];

            ProcessKillerImpl.KillProcess(process);
            ProcessKillerImpl.KillProcess(process);
        }
コード例 #2
0
        public async void KillProcesses()
        {
            ICollection <Process> testProcesses = SpawnTestProcesses(2);

            testProcesses.Should().NotContain(process => process.HasExited, "haven't killed anything yet");

            await processKiller.KillProcess("calc", cancellationTokenSource.Token);

            testProcesses.Should().OnlyContain(process => process.HasExited, "all processes should have been killed");
        }
コード例 #3
0
        public void KillProcessNoPermissions()
        {
            Process systemIdleProcess = Process.GetProcessById(0);

            ProcessKillerImpl.KillProcess(systemIdleProcess);
        }