mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -10:00
* TimerTest.cs: Beginnings of regression tests for the Timer class. svn path=/trunk/mcs/; revision=25246
37 lines
695 B
C#
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);
|
|
}
|
|
}
|
|
}
|