Ejemplo n.º 1
0
        public void ConvertTime()
        {
            HighResolutionTimer timer = new HighResolutionTimer();

            timer.Start();
            Wait();
            timer.Stop();

            double duration = timer.Duration(1);

            Assert.Between(
                HighResolutionTimer.TimeToMilliseconds(duration),
                duration * TimeToMilliseconds * (1.0 - Variation),
                duration * TimeToMilliseconds * (1.0 + Variation)
                );
            Assert.Between(
                HighResolutionTimer.TimeToSeconds(duration),
                duration * TimeToSeconds * (1.0 - Variation),
                duration * TimeToSeconds * (1.0 + Variation)
                );
            Assert.Between(
                HighResolutionTimer.TimeToTimeSpan(duration).TotalSeconds,
                duration * TimeToSeconds * (1.0 - Variation),
                duration * TimeToSeconds * (1.0 + Variation)
                );
        }