Example #1
0
        private void SetupTest(Action <int> action)
        {
            queue = new BlockingCollection <int>();

            dispatcher = new WorkItemDispatcherMock(queue, action);
            thread     = new WorkingThread(dispatcher);

            isThreadCompleted = false;
            threadException   = null;
            thread.Complete  += (object sender, WorkingThread.CompletionEventArgs e) =>
            {
                isThreadCompleted = true;
                threadException   = e.Exception;
                Console.WriteLine("thread finished, current thread #{0} {1}, ex={2}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.Name, threadException);
            };
        }
Example #2
0
        private void SetupTest(Action <int> action)
        {
            queue = new BlockingCollection <int>();

            dispatcher = new WorkItemDispatcherMock(queue, action);
        }