예제 #1
0
        public void ShouldThrowExceptionAboutEndingOfThreadWorking()
        {
            threadPool = new MyThreadPool.ThreadPool(2);
            var task = threadPool.AddTask(() => 5);

            threadPool.Shutdown();
            var taskAfterShutDown = threadPool.AddTask(() => 5);
        }
예제 #2
0
        public void CountAliveThreadAfterShutDown()
        {
            var numberThreads = 10;

            threadPool = new MyThreadPool.ThreadPool(numberThreads);
            threadPool.Shutdown();
            Assert.AreEqual(0, threadPool.CountAliveThread());
        }
예제 #3
0
        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);
        }
예제 #4
0
 public void Clean()
 {
     threadPool.Shutdown();
 }