public void IsRunningWithExistingStopwatch() { var msw = new MultiStopwatch(); msw.Start("test"); Assert.IsTrue(msw.IsRunning("test")); }
public void ElapsedWithExistingStopwatch() { var msw = new MultiStopwatch(); msw.Start("test"); var elapsedTimeSpan = msw.Elapsed("test"); Assert.IsTrue(elapsedTimeSpan.Ticks>=0); }
public void RestartExistingThatRuns() { var msw = new MultiStopwatch(); msw.Start("test"); Thread.Sleep(100); var elapsedBeforeRestart = msw.Elapsed("test"); msw.Restart("test"); var elapsedAfterRestart = msw.Elapsed("test"); //this fails if Restart and Elapsed takes longer then 100ms, which can habben while debugging. Assert.Less(elapsedAfterRestart, elapsedBeforeRestart); }
public void StartTwoStopwatchedWithSameIdBuildOfTwoString() { var msw = new MultiStopwatch(); msw.Start("test"); var stringBuilder = new StringBuilder(); stringBuilder.Append("te"); stringBuilder.Append("st"); msw.Start(stringBuilder.ToString()); }
public void StartSingleStopwatch() { var msw = new MultiStopwatch(); var sw = msw.Start("test"); Assert.IsTrue(sw.IsRunning); }
public void RestartExisting() { var msw = new MultiStopwatch(); msw.Start("test"); msw.Restart("test"); }
public void StopExistingThatRuns() { var msw = new MultiStopwatch(); var start = msw.Start("test"); var stop = msw.Stop("test"); Assert.AreEqual(start, stop); Assert.IsFalse(stop.IsRunning); }
public void StartTwoStopwatchedWithSameIdWhereFirstIsStopped() { var msw = new MultiStopwatch(); var sw = msw.Start("test"); sw.Stop(); msw.Start("test"); }