public void should_be_invoke_batch_count_success(int count) { BatchActionInvoker.Invocations.Clear(); Enumerable.Range(0, count).ToList().ForEach(p => { var data = new SomeBatchData(); _batchToken.Send(data); }); _batchToken.Stop(); _batchToken.Dispose(); DispatcherToken.WaitCompleted(); BatchActionInvoker.Verify(p => p.Invoke(It.Is <SomeBatchData[]>(x => x.Length == count), It.IsAny <CancellationToken>()), Times.Once); }
public void execute_batch_count_exceeded() { var countExceeded = MAX_COUNT_ITEMS + 1; BatchActionInvoker.Invocations.Clear(); Enumerable.Range(0, countExceeded).ToList().ForEach(p => { var data = new SomeBatchData(); _batchToken.Send(data); }); _batchToken.Stop(); _batchToken.Dispose(); DispatcherToken.WaitCompleted(); BatchActionInvoker.Verify(p => p.Invoke(It.Is <SomeBatchData[]>(x => x.Length == MAX_COUNT_ITEMS), It.IsAny <CancellationToken>()), Times.Once); }