public async Task BeforeAll()
 {
     _batchExceptionEvents = new ConcurrentBag <Tuple <object, BatchExceptionEventArguments> >();
     _setup = new ChainBatcherTestSetup();
     _setup.ThrowWhenSquaring(ThrowWhenSquaring);
     _setup.ThrowWhenConvertingToString(ThrowWhenConvertingToString);
     _setup.ThrowWhenPuttingInResultsBag(ThrowWhenPuttingInResultsBag);
     _batcher = _setup.GetBatcher(_synchronicity);
     _batcher.ExceptionEvent += (o, e) => _batchExceptionEvents.Add(Tuple.Create(o, e));
     _batcher.Process(_setup.StartItems);
     await _batcher.WaitUntilDone();
 }
Beispiel #2
0
 public async Task BeforeAll()
 {
     _setup   = new ChainBatcherTestSetup();
     _batcher = _setup.GetBatcher(_synchronicity, _multiplicity);
     _batcher.Process(_setup.StartItems);
     var expectedCount = _setup.StartItems.Count;
     await Task.WhenAll(
         _batcher.WaitUntilDone(),
         _setup.WaitUntil(s => s.ProcessedItems.Count >= expectedCount, s => s.ProcessedItems.GetMessage()),
         _setup.WaitUntil(s => s.SquaredItems.Count >= expectedCount, s => s.SquaredItems.GetMessage()),
         _setup.WaitUntil(s => s.ConvertedToString.Count == expectedCount, s => s.ConvertedToString.GetMessage()),
         _setup.WaitUntil(s => s.Results.Count >= expectedCount, s => s.Results.GetMessage()));
 }