public void OutputOutputs() { TestTask testTask = Substitute.ForPartsOf <TestTask>(); ITaskInteraction interaction = Substitute.For <ITaskInteraction>(); testTask.Execute(interaction); interaction.Received(1).Output("TestOutput"); }
public void CascadeError() { var sw = new StringWriter(); var t1 = new TestTask {DoError = true}; var t2 = new TestTask(sw); t2.RequiredModules.Add(t1); t1.Execute(); t2.Execute(); Console.WriteLine(sw.ToString()); Assert.AreEqual(@" S:Pending S:CascadeError ".Trim(), sw.ToString().Trim()); }
public void Execute_should_call_wait_for_exit_before_ExitCode() { //Since mono is broken and won't give us the ExitCode otherwise. var process = new ProcessStub(); var waitForExitCalled = false; process.WaitForExitHandler = () => waitForExitCalled = true; process.GetExitCodeHandler = () => { Assert.IsTrue(waitForExitCalled); return 0; }; var platform = new ExecutionEnvironmentStub(); platform.RunHandler = (program, args, handler) => handler(process); var task = new TestTask(platform); task.Execute(); }