StopwatchTest.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Reactive.Concurrency;
  5. namespace ReactiveTests.Tests
  6. {
  7. internal static class StopwatchTest
  8. {
  9. public static void Run(IStopwatchProvider stopwatchProvider)
  10. {
  11. /*
  12. * TODO: Temporarily disabled until we iron out all of the scheduler improvements.
  13. */
  14. //var N = 10;
  15. //var t = default(long);
  16. //var d = 1;
  17. //for (int i = 0; i < N; i++)
  18. //{
  19. // var sw = stopwatchProvider.StartStopwatch();
  20. // var e1 = sw.Elapsed;
  21. // Thread.Sleep(d);
  22. // var e2 = sw.Elapsed;
  23. // Assert.True(e2.Ticks > e1.Ticks);
  24. // t += (e2 - e1).Ticks;
  25. // sw.Dispose();
  26. //}
  27. //Assert.True(TimeSpan.FromTicks(t / N).TotalMilliseconds < d * 10 /* 10x margin */);
  28. }
  29. }
  30. }