public static async Task ExecuteAsync(this AppRunner runner, Func <Task> func) { try { await runner.StartAsync(CommonTestTimeouts.StartProcess); await runner.SendStartScenarioAsync(CommonTestTimeouts.SendCommand); await func(); await runner.SendEndScenarioAsync(CommonTestTimeouts.SendCommand); // This gives the app time to send out any remaining stdout/stderr messages, // exit properly, and delete its diagnostic pipe. await runner.WaitForExitAsync(CommonTestTimeouts.WaitForExit); } catch (Exception) { // If an exception is thrown, give app some time to send out any remaining // stdout/stderr messages. await Task.Delay(ExceptionTimeout); throw; } finally { await runner.DisposeAsync(); } }
public static Task SendEndScenarioAsync(this AppRunner runner) { return(runner.SendEndScenarioAsync(CommonTestTimeouts.SendCommand)); }