示例#1
0
        public void TestTimeoutCase() //What if underlying work exceeds timeout.
        {
            ThreadMachine <string> thMachine = new ThreadMachine <string>();
            List <string>          lItems    = TestHelper.ReadFileToServerList(@"TestMaterial\sl.txt");

            lItems.ForEach(i => thMachine.QueueItem(new WorkItem(i).DoWorkWithTimeout, i));
            thMachine.InvokeMultiThread();
            foreach (string strItem in thMachine.GetResults())
            {
                Console.WriteLine(strItem);
            }
            ;
        }
示例#2
0
        public void TestErrorCase() //What if Do Work raise exception
        {
            ThreadMachine <string> thMachine = new ThreadMachine <string>();
            List <string>          lItems    = TestHelper.ReadFileToServerList(@"TestMaterial\sl.txt");

            lItems.ForEach(i => thMachine.QueueItem(new WorkItem(i).DoWorkWithError, i));
            thMachine.InvokeMultiThread();
            foreach (string strItem in thMachine.GetResults())
            {
                Console.WriteLine(strItem);
            }
            ;
        }