public void MinimumTest() { const int iterations = 10; var target = new StopWatch2(); target.Start(); Assert.IsTrue(target.IsRunning); for (int i = 0; i < iterations; i++) { Thread.Sleep(34); target.RestartAndLog(); Assert.IsTrue(target.IsRunning); } target.Stop(); Assert.IsFalse(target.IsRunning); Assert.IsTrue(target.Minimum.Accuracy > 10); Assert.IsTrue(target.Minimum.MilliSeconds > 32); Assert.IsTrue(target.Minimum.Ticks > 1000); }
public void StopWatchTest1() { const int iterations = 10; var target = new StopWatch2(); target.Start(); Assert.IsTrue(target.IsRunning); for (int i = 0; i < iterations; i++) { Thread.Sleep(34); target.RestartAndLog(); } target.Stop(); Assert.IsFalse(target.IsRunning); }