public async Task SingleProcess_EnableRaisingEvents_CorrectExitCode(int exitCode)
{
using (Process p = RemoteInvoke(exitCodeStr => int.Parse(exitCodeStr), exitCode.ToString(), new RemoteInvokeOptions { Start = false }).Process)
{
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
p.EnableRaisingEvents = true;
p.Exited += delegate { tcs.SetResult(true); };
p.Start();
Assert.True(await tcs.Task);
Assert.Equal(exitCode, p.ExitCode);
}
}