public void KillCommandInstruction() { // We check that the callback is executed correctly when we kill the process var cmd = new Program.CommandInstruction("cmd", new List <string>(), this.commandLine); cmd.Execute(this.process, this.mock.Action, new List <string>()); Assert.IsFalse(this.mock.Called); this.manager.KillAll("cmd"); Assert.IsTrue(this.mock.Called); this.tick(); Assert.AreEqual(1, this.mock.CallCount); }
public void CommandInstruction() { var cmd = new Program.CommandInstruction("cmd", new List <string> { "arg1", "arg2" }, this.commandLine); cmd.Execute(this.process, this.mock.Action, new List <string>()); List <string> processes = this.getProcesses(); Assert.AreEqual(2, processes.Count); Assert.IsTrue(processes.Any(s => s.Contains("cmd"))); Assert.IsFalse(this.mock.Called); this.tick(); processes = this.getProcesses(); Assert.AreEqual(1, processes.Count); Assert.AreEqual(1, this.commandCalls.Count); Assert.AreEqual("arg1,arg2", this.commandCalls[0]); Assert.IsTrue(this.mock.Called); Assert.IsFalse(processes.Any(s => s.Contains("cmd"))); }