41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
// /**
|
|
// * File: SchedulingPoolTests.cs
|
|
// * Author: haraldwolff
|
|
// *
|
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
|
// *
|
|
// *
|
|
// **/
|
|
using NUnit.Framework;
|
|
using System;
|
|
using ln.types.threads;
|
|
using System.Threading;
|
|
namespace ln.types.test
|
|
{
|
|
[TestFixture()]
|
|
public class SchedulingPoolTests
|
|
{
|
|
[Test()]
|
|
public void TestCase()
|
|
{
|
|
int[] c = new int[5];
|
|
SchedulingPool schedulingPool = new SchedulingPool();
|
|
|
|
schedulingPool.Schedule(() => c[0]++, 2000);
|
|
schedulingPool.Schedule(() => c[1]++, 3000);
|
|
schedulingPool.Schedule(() => c[2]++, 4000);
|
|
schedulingPool.Schedule(() => c[3]++, 5000);
|
|
schedulingPool.Schedule(() => c[4]++, 6000);
|
|
|
|
Thread.Sleep(21000);
|
|
|
|
Assert.AreEqual(10, c[0]);
|
|
Assert.AreEqual(7, c[1]);
|
|
Assert.AreEqual(5, c[2]);
|
|
Assert.AreEqual(4, c[3]);
|
|
Assert.AreEqual(3, c[4]);
|
|
}
|
|
}
|
|
}
|