StopwatchTest.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #pragma warning disable IDE0060 // (Remove unused parameter.) Will be used when code reinstated
  10. public static void Run(IStopwatchProvider stopwatchProvider)
  11. #pragma warning restore IDE0060
  12. {
  13. /*
  14. * TODO: Temporarily disabled until we iron out all of the scheduler improvements.
  15. */
  16. //var N = 10;
  17. //var t = default(long);
  18. //var d = 1;
  19. //for (int i = 0; i < N; i++)
  20. //{
  21. // var sw = stopwatchProvider.StartStopwatch();
  22. // var e1 = sw.Elapsed;
  23. // Thread.Sleep(d);
  24. // var e2 = sw.Elapsed;
  25. // Assert.True(e2.Ticks > e1.Ticks);
  26. // t += (e2 - e1).Ticks;
  27. // sw.Dispose();
  28. //}
  29. //Assert.True(TimeSpan.FromTicks(t / N).TotalMilliseconds < d * 10 /* 10x margin */);
  30. }
  31. }
  32. }