StopwatchTest.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. #if !NO_STOPWATCH
  3. using System;
  4. using System.Reactive.Concurrency;
  5. using System.Threading;
  6. using Xunit;
  7. namespace ReactiveTests.Tests
  8. {
  9. static class StopwatchTest
  10. {
  11. public static void Run(IStopwatchProvider stopwatchProvider)
  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. }
  33. #endif