public void TestProcessStartTime()
{
TimeSpan allowedWindow = TimeSpan.FromSeconds(3);
DateTime testStartTime = DateTime.UtcNow;
using (var remote = RemoteInvoke(() => { Console.Write(Process.GetCurrentProcess().StartTime.ToUniversalTime()); return SuccessExitCode; },
new RemoteInvokeOptions { StartInfo = new ProcessStartInfo { RedirectStandardOutput = true } }))
{
DateTime remoteStartTime = DateTime.Parse(remote.Process.StandardOutput.ReadToEnd());
DateTime curTime = DateTime.UtcNow;
Assert.InRange(remoteStartTime, testStartTime - allowedWindow, curTime + allowedWindow);
}
}