public void TestMergingReenteringJobs() { _jobCount = 0; AsyncProcessor processor = new AsyncProcessor(); using ( processor ) { const int total = 5; EnumeratorJob job = new EnumeratorJob(total, 100); processor.QueueJob(job); Thread.Sleep(250); processor.QueueJob(job); Thread.Sleep(550); if (_jobCount != total + 2) { throw new Exception("TestMergingReenteringJobs() failed. _jobCount = " + _jobCount); } } }
public void TestRunReenteringEnumerator() { _jobCount = 0; AsyncProcessor processor = new AsyncProcessor(); using ( processor ) { const int total = 5; EnumeratorJob job = new EnumeratorJob(total, 100); DateTime start = DateTime.Now; processor.RunJob(job); if (start.AddMilliseconds(total * 99) > DateTime.Now) { throw new Exception("TestRunReenteringEnumerator() finished too early. _jobCount = " + _jobCount); } if (_jobCount != total + 1) { throw new Exception("TestRunReenteringEnumerator() failed. _jobCount = " + _jobCount); } } }