Beispiel #1
0
 public BanlistInformationTaskHandler
 (
     IArticleCategoryProcessor articleCategoryProcessor,
     IValidator <BanlistInformationTask> validator,
     IBanlistProcessor banlistProcessor
 )
 {
     _articleCategoryProcessor = articleCategoryProcessor;
     _validator        = validator;
     _banlistProcessor = banlistProcessor;
 }
Beispiel #2
0
        public void SetUp()
        {
            _articleCategoryProcessor = Substitute.For <IArticleCategoryProcessor>();
            _validator        = Substitute.For <IValidator <BanlistInformationTask> >();
            _banlistProcessor = Substitute.For <IBanlistProcessor>();

            _sut = new BanlistInformationTaskHandler
                   (
                _articleCategoryProcessor,
                _validator,
                _banlistProcessor
                   );
        }
Beispiel #3
0
        public ArticleDataFlow(IBanlistProcessor banlistProcessor, IBanlistDataQueue banlistDataQueue)
        {
            _jobs = new ConcurrentDictionary <Guid, TaskCompletionSource <ArticleCompletion> >();

            // Data flow options
            var maxDegreeOfParallelism = Environment.ProcessorCount;
            var nonGreedy = new ExecutionDataflowBlockOptions {
                BoundedCapacity = maxDegreeOfParallelism, MaxDegreeOfParallelism = maxDegreeOfParallelism
            };

            // Pipeline members
            _articleBufferBlock = new BufferBlock <Article>();

            var banlistProcessorTransformBlock = new TransformBlock <Article, ArticleProcessed>(article => banlistProcessor.Process(article), nonGreedy);
            var publishBanlistTransformBlock   = new TransformBlock <ArticleProcessed, YugiohBanlistCompletion>(articleProcessed => banlistDataQueue.Publish(articleProcessed), nonGreedy);
            var publishToQueueActionBlock      = new ActionBlock <YugiohBanlistCompletion>(yugiohCardCompletion => FinishedProcessing(yugiohCardCompletion));

            // Form the pipeline
            _articleBufferBlock.LinkTo(banlistProcessorTransformBlock);
            banlistProcessorTransformBlock.LinkTo(publishBanlistTransformBlock);
            publishBanlistTransformBlock.LinkTo(publishToQueueActionBlock);
        }
 public void SetUp()
 {
     _banlistProcessor = Substitute.For <IBanlistProcessor>();
     _banlistDataQueue = Substitute.For <IBanlistDataQueue>();
     _sut = new ArticleDataFlow(_banlistProcessor, _banlistDataQueue);
 }