public void ShouldThrowExceptionAboutEndingOfThreadWorking() { threadPool = new MyThreadPool.ThreadPool(2); var task = threadPool.AddTask(() => 5); threadPool.Shutdown(); var taskAfterShutDown = threadPool.AddTask(() => 5); }
public void CountAliveThreadAfterShutDown() { var numberThreads = 10; threadPool = new MyThreadPool.ThreadPool(numberThreads); threadPool.Shutdown(); Assert.AreEqual(0, threadPool.CountAliveThread()); }
public void TaskOfContinueWithAfterShutDownShouldThrowException() { threadPool = new MyThreadPool.ThreadPool(4); var taskWhichWillContinue = threadPool.AddTask(() => { var temp = 1; var result = 0; for (int i = 0; i < 1000; i++) { temp += i; result += i; } return(result); }); threadPool.Shutdown(); var res = taskWhichWillContinue.ContinueWith(result => result + result); }
public void Clean() { threadPool.Shutdown(); }