public IActionResult Build(int projectID) { foreach (var command in _commandRepository.GetCommands(projectID)) { command.CommandResult = _terminal.Execute(command.CommandText); var expectResult = false; switch (command.ExpectOperator) { case ExpectOperator.Equal: expectResult = command.CommandResult == command.ExpectValue; break; case ExpectOperator.Contain: expectResult = command.CommandResult.Contains(command.ExpectValue); break; case ExpectOperator.None: expectResult = true; break; } if (!expectResult) { break; } } return(View()); }
public static Process Execute(this ITerminal terminal, string command, string workingDirectory) => terminal.Execute(command, workingDirectory, false);