예제 #1
0
            public async Task It_reports_successful_when_processItem_returns_true()
            {
                using (var threadPool = new ConsumerThreadPool <int>(2, item => true))
                {
                    for (var i = 0; i < 100; i++)
                    {
                        threadPool.Add(i);
                    }

                    threadPool.CompleteAdding();
                    await threadPool.WaitForCompletion();

                    Assert.That(threadPool.ItemsSuccessful, Is.EqualTo(threadPool.TotalItems));
                }
            }
예제 #2
0
            public async Task It_reports_progress()
            {
                using (var threadPool = new ConsumerThreadPool <int>(2, item => false))
                {
                    for (var i = 0; i < 100; i++)
                    {
                        threadPool.Add(i);
                    }

                    threadPool.CompleteAdding();
                    await threadPool.WaitForCompletion();

                    Assert.That(threadPool.Progress, Is.EqualTo(100));
                }
            }