public void FiltersOutMissingProcesses() { var processes = new[] { Process.Start("cmd.exe"), Process.Start("cmd.exe"), }; try { var processHelper = new ProcessHelper(); var processIds = processes.Select(p => p.Id).ToList(); processIds.Add(1); var result = processHelper.GetProcesses(processes.Select(p => p.Id)); Assert.Collection(result, x => Assert.Equal(processes[0].Id, x.Id), x => Assert.Equal(processes[1].Id, x.Id) ); } finally { foreach (var p in processes) { p.Kill(); } } }
public void ReturnsProcesses() { var processes = new [] { Process.Start("cmd.exe"), Process.Start("cmd.exe"), }; try { var processHelper = new ProcessHelper(); var result = processHelper.GetProcesses(processes.Select(p => p.Id)); Assert.Collection(result, x => Assert.Equal(processes[0].Id, x.Id), x => Assert.Equal(processes[1].Id, x.Id) ); } finally { foreach (var p in processes) { p.Kill(); } } }
public void FiltersOutMissingProcesses() { var processes = new[] { Process.Start("cmd.exe"), Process.Start("cmd.exe"), }; try { var processHelper = new ProcessHelper(); var processIds = processes.Select(p => p.Id).ToList(); processIds.Add(1); var result = processHelper.GetProcesses(processes.Select(p => p.Id)); Assert.Collection(result, x => Assert.Equal(processes[0].Id, x.Id), x => Assert.Equal(processes[1].Id, x.Id) ); } finally { foreach (var p in processes) p.Kill(); } }
public void ReturnsProcesses() { var processes = new [] { Process.Start("cmd.exe"), Process.Start("cmd.exe"), }; try { var processHelper = new ProcessHelper(); var result = processHelper.GetProcesses(processes.Select(p => p.Id)); Assert.Collection(result, x => Assert.Equal(processes[0].Id, x.Id), x => Assert.Equal(processes[1].Id, x.Id) ); } finally { foreach (var p in processes) p.Kill(); } }