public void Report(ShellCommand command, CommandResult result) { this.errorTaskHandler.Remove(command); var resultTasks = this.BuildErrorTask(command, result.Result); this.errorTaskHandler.Add(resultTasks); }
public Task Create(ShellCommand command) { return new Task(() => { CommandOutput commandOutput; CommandResult output = new CommandResult("", "", ""); try { output = this.commandRunner.RunCommand(command); var resultLog = this.logParser.Parse(output.Result); var outputLog = this.logParser.Parse(output.Output); var errorLog = this.logParser.Parse(output.Error); commandOutput = resultLog; commandOutput.Results.AddRange(outputLog.Results); commandOutput.Results.AddRange(errorLog.Results); } catch (Exception ex) { commandOutput = new CommandOutput("goose", "Failed to run command: " + command.Command, ex.ToString(), CommandOutputItemType.Error); output = new CommandResult(commandOutput.ToString(), "", ""); } this.errorReporter.Report(command, output); this.outputService.Handle(commandOutput); }); }
public void Should_parse_command_result_when_creating_error_task() { var result = new CommandResult("build log", null, null); this.errorReporter.Report(A.Fake<ShellCommand>(), result); A.CallTo(() => this.logParser.Parse("build log")).MustHaveHappened(); }