Files
mono/mcs/class/corlib/Test/System.Threading/TimerTest.cs
T
Zoltan Varga 588e491fc8 2004-04-09 Zoltan Varga <[email protected]>
* TimerTest.cs: Beginnings of regression tests for the Timer class.

svn path=/trunk/mcs/; revision=25246
2004-04-09 13:16:16 +00:00

37 lines
695 B
C#

//
// TimerTest.cs - NUnit test cases for System.Threading.Timer
//
// Author:
// Zoltan Varga ([email protected])
//
// (C) 2004 Novell, Inc (http://www.novell.com)
//
using NUnit.Framework;
using System;
using System.Threading;
namespace MonoTests.System.Threading {
[TestFixture]
public class TimerTest : Assertion {
public int counter;
private void Callback (object foo) {
counter ++;
}
public void TestZeroDueTime () {
counter = 0;
Timer t = new Timer (new TimerCallback (Callback), null, 0, Timeout.Infinite);
Thread.Sleep (100);
AssertEquals (1, counter);
t.Change (0, Timeout.Infinite);
Thread.Sleep (100);
AssertEquals (2, counter);
}
}
}