Esempio n. 1
0
        public void CancellationTest()
        {
            int BasicFunc() => 10;

            var pool = new MyThreadPool(4);
            var task = pool.AddTask(BasicFunc);

            pool.Shutdown();
            Thread.Sleep(50);

            Assert.Equal(10, task.Result);
            Assert.Equal(0, pool.ThreadsCount());
        }
Esempio n. 2
0
        public void ThreadNumberTest()
        {
            var pool = new MyThreadPool(5);

            Assert.Equal(5, pool.ThreadsCount());
        }