diff options
author | Dan Moseley <danmose@microsoft.com> | 2018-04-05 21:24:28 +0300 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2018-04-05 21:24:28 +0300 |
commit | ffb16981972bf88ba73e21f890b215fa98487f8b (patch) | |
tree | d22108e9eacd7191be533a0a74928ac7f2673221 /src | |
parent | 4739720ad1f70c7202b870048f932a10cd0214ed (diff) |
Increase window for process start time test (#28852)
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Diagnostics.Process/tests/ProcessThreadTests.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs index cda6074d3f..df00d40b03 100644 --- a/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs +++ b/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs @@ -90,7 +90,7 @@ namespace System.Diagnostics.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Retrieving information about local processes is not supported on uap")] public async Task TestStartTimeProperty() { - TimeSpan allowedWindow = TimeSpan.FromSeconds(1); + TimeSpan allowedWindow = TimeSpan.FromSeconds(2); using (Process p = Process.GetCurrentProcess()) { @@ -129,7 +129,8 @@ namespace System.Diagnostics.Tests p.Refresh(); try { - Assert.Contains(p.Threads.Cast<ProcessThread>(), t => t.StartTime.ToUniversalTime() >= curTime - allowedWindow); + var newest = p.Threads.Cast<ProcessThread>().OrderBy(t => t.StartTime.ToUniversalTime()).Last(); + Assert.InRange(newest.StartTime.ToUniversalTime(), curTime - allowedWindow, DateTime.Now.ToUniversalTime() + allowedWindow); } catch (InvalidOperationException) { |