New test.
[mono.git] / mcs / class / corlib / Test / System.Threading / TimerTest.cs
index a95130ccde8a5092ac17fa8fa9266e61fa3a3f89..cc0e3976950ee738ba52fbe1cee3ed69dcb4a180 100644 (file)
@@ -22,15 +22,9 @@ namespace MonoTests.System.Threading {
        // Am going with door #1, but it would be nice to investigate this.
        // -- Ben
        //
-       [Category ("NotWorking")]
        public class TimerTest : Assertion {
-
-               public int counter;
-               
-               private void Callback (object foo) {
-                       counter ++;
-               }
-
+               [Test]
+               [Category ("NotWorking")]
                public void TestDueTime ()
                {
                        counter = 0;
@@ -47,7 +41,9 @@ namespace MonoTests.System.Threading {
                        Assert ("t3", counter > 20);
                        t.Dispose ();
                }
-               
+
+               [Test]
+               [Category ("NotWorking")]
                public void TestChange ()
                {
                        counter = 0;
@@ -61,6 +57,8 @@ namespace MonoTests.System.Threading {
                        t.Dispose ();
                }
 
+               [Test]
+               [Category ("NotWorking")]
                public void TestZeroDueTime () {
                        counter = 0;
 
@@ -72,7 +70,9 @@ namespace MonoTests.System.Threading {
                        AssertEquals (2, counter);
                        t.Dispose ();
                }
-               
+
+               [Test]
+               [Category ("NotWorking")]
                public void TestDispose ()
                {
                        counter = 0;
@@ -85,12 +85,17 @@ namespace MonoTests.System.Threading {
                        Thread.Sleep (200);
                        AssertEquals (c, counter);
                }
-               
-               private void CallbackTestDispose (object foo) {
-                       counter ++;
-               }
 
-               Timer t1;
+               [Test] // bug #78208
+               public void TestDispose2 ()
+               {
+                       Timer t = new Timer (new TimerCallback (CallbackTestDispose), null, 10, 10);
+                       t.Dispose ();
+                       t.Dispose ();
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
                public void TestDisposeOnCallback () {
                        counter = 0;
                        t1 = new Timer (new TimerCallback (CallbackTestDisposeOnCallback), null, 0, 10);
@@ -110,5 +115,18 @@ namespace MonoTests.System.Threading {
                                t1 = null;
                        }
                }
+
+               private void CallbackTestDispose (object foo)
+               {
+                       counter++;
+               }
+
+               private void Callback (object foo)
+               {
+                       counter++;
+               }
+
+               Timer t1;
+               int counter;
        }
 }