public void DoesNotGoBelowMinimumThreads( )
{
ThreadManager tm = new ThreadManager(1, 100, TimeSpan.MaxValue, TimeSpan.MaxValue, 100, TimeSpan.FromMilliseconds(100));
System.Threading.Thread.Sleep(200);
Assert.AreEqual(1, tm.NumThreads, "Spawned more than the minimum threads?");
bool result = tm.DespawnThreadIfNeeded();
Assert.IsFalse(result, "Reported that it despawned a thread when at minimum.");
Assert.AreEqual(1, tm.NumThreads, "Despawned a thread to get below minimum.");
tm = new ThreadManager(5, 100, TimeSpan.MaxValue, TimeSpan.MaxValue, 100, TimeSpan.FromMilliseconds(100));
System.Threading.Thread.Sleep(200);
Assert.AreEqual(5, tm.NumThreads, "Spawned more than the minimum threads?");
result = tm.DespawnThreadIfNeeded();
Assert.IsFalse(result, "Reported that it despawned a thread when at minimum.");
Assert.AreEqual(5, tm.NumThreads, "Despawned a thread to get below minimum.");
}