5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc.
10 using System.Diagnostics;
11 using System.Threading;
12 using NUnit.Framework;
14 namespace MonoTests.System.Diagnostics
17 public class StopwatchTest
20 public void TestSimple ()
22 // It starts at started state.
23 Stopwatch sw = Stopwatch.StartNew ();
26 long ticks = sw.ElapsedTicks;
27 Assert.IsTrue (sw.ElapsedMilliseconds > 100, "#1");
29 // do not increment resuts
30 Assert.AreEqual (ticks, sw.ElapsedTicks, "#2");
34 Assert.IsTrue (sw.ElapsedTicks > ticks, "#3");
35 ticks = sw.ElapsedTicks;
37 Assert.IsTrue (sw.ElapsedTicks >= ticks, "#4");
39 Assert.AreEqual (0, sw.ElapsedTicks, "#5");
42 Assert.IsTrue (sw.ElapsedTicks > 100, "#5");
43 // This test is not strict but would mostly work.
44 Assert.IsTrue (ticks > sw.ElapsedTicks, "#6");