System.Tests.EnvironmentTickCount.TickCountTest C# (CSharp) Method

TickCountTest() private method

private TickCountTest ( ) : void
return void
        public void TickCountTest()
        {
            int start = Environment.TickCount;
            HashSet<int> times = new HashSet<int>();
            Func<bool> test = () =>
            {
                int time = Environment.TickCount;
                times.Add(time);
                return time - start > 0;
            };
            Assert.True(
                SpinWait.SpinUntil(test, TimeSpan.FromSeconds(1)) || test(),
                $"TickCount did not increase after one second. start: {start}, values tested: {string.Join(", ", times.ToArray())}.");
        }
    }
EnvironmentTickCount