/// <summary> /// Creates an <see cref="ExecutorCompletionService{T}"/> using the supplied /// executor for base task execution and the supplied queue as its /// completion queue. /// </summary> /// <param name="executor">the executor to use</param> /// <param name="completionQueue">the queue to use as the completion queue /// normally one dedicated for use by this service /// </param> /// <exception cref="System.ArgumentNullException"> /// if the executor is null /// </exception> public ExecutorCompletionService(IExecutor executor, IBlockingQueue <IFuture <T> > completionQueue) { if (executor == null) { throw new ArgumentNullException("executor", "Executor cannot be null."); } if (completionQueue == null) { throw new ArgumentNullException("completionQueue", "Completion Queue cannot be null."); } _executor = executor; _aes = executor as AbstractExecutorService; _completionQueue = completionQueue; }
[SetUp] public void SetUp() { _sut = Mockery.GeneratePartialMock <AbstractExecutorService>(); _runnable = MockRepository.GenerateMock <IRunnable>(); _action = MockRepository.GenerateMock <Action>(); _calls = new Func <T> [_size]; _callables = new ICallable <T> [_size]; for (int i = _size - 1; i >= 0; i--) { _callables[i] = MockRepository.GenerateMock <ICallable <T> >(); _calls[i] = MockRepository.GenerateMock <Func <T> >(); } _call = _calls[0]; _callable = _callables[0]; _sut.Stub(x => x.Protected <Action <IRunnable> >("DoExecute")(Arg <IRunnable> .Is.NotNull)) .Do(new Action <IRunnable>(Execute)); _actionOnExecute = r => r.Run(); // Default run it. ThreadManager = new TestThreadManager(); }
[SetUp] public void SetUp() { _executor = Mockery.GeneratePartialMock <AbstractExecutorService>(); _sut = new ExecutorCompletionService <T>(_executor); _blockingQueue = MockRepository.GenerateMock <IBlockingQueue <IFuture <T> > >(); }