예제 #1
0
 public WorkerPoolShould()
 {
     _workerPool        = new WorkerPool();
     _firstWorker       = new Mock <IWorker>();
     _secondWorker      = new Mock <IWorker>();
     _cancellationToken = new CancellationToken(false);
     _workerPool.Add(_firstWorker.Object, _secondWorker.Object);
 }
예제 #2
0
        public void Not_allow_to_register_workers_when_started()
        {
            // Act
            _workerPool.Start(_cancellationToken);
            Action addAfterStart = () => _workerPool.Add(new Mock <IWorker>().Object);

            // Assert
            addAfterStart.ShouldThrow <ApplicationException>();
        }