Example #1
0
        public void ExecuteAsync_CallsRepository_Always()
        {
            _productsPipeline.ExecuteAsync();

            A.CallTo(() => _productRepository.FindAllAsync(A <Expression <Func <Product, bool> > > ._))
            .MustHaveHappenedOnceExactly();
        }
Example #2
0
        public void FindAllAsync_AppendsDetailsFromSqlToGameRoots_WhenFound()
        {
            var testRoots = CreateGameRoots(new GameDetails());
            var details   = CreateGameDetails();

            A.CallTo(() => _gameRootPipeline.ExecuteAsync()).Returns(testRoots);
            A.CallTo(() => _gameDetailsPipeline.ExecuteAsync()).Returns(details);

            var roots = _gameRootAggregator.FindAllAsync(new GameFilterData()).Result;
            var allNotEmptyDetails = roots.All(gr => gr.Details != null);

            allNotEmptyDetails.Should().BeTrue();
        }
        public Task HandleAsync(TCommand command)
        {
            T instance = handlerFactory.Create();
            IKeyValueCollection customValues = new KeyValueCollection()
                                               .Add("Command", command);

            return(pipeline.ExecuteAsync(instance, customValues));
        }
Example #4
0
        public Task HandleAsync(TEvent payload)
        {
            T instance = handlerFactory.Create();
            IKeyValueCollection customValues = new KeyValueCollection()
                                               .Add("Event", payload);

            return(pipeline.ExecuteAsync(instance, customValues));
        }
Example #5
0
        public async Task <TResult> HandleAsync(TQuery query)
        {
            T instance = handlerFactory.Create();
            IKeyValueCollection customValues = new KeyValueCollection()
                                               .Add("Query", query);

            await pipeline.ExecuteAsync(instance, customValues);

            return(customValues.Get <TResult>("Result"));
        }
Example #6
0
        public async Task <string> ExtractRequestAsync(HttpContext context)
        {
            _curlRequest.AppendLine($"curl {context.Request.GetEncodedUrl()}");

            var extractedData = await _extractionPipeline.ExecuteAsync(context).ConfigureAwait(false);

            if (!string.IsNullOrWhiteSpace(extractedData))
            {
                _curlRequest.AppendLine(extractedData);
            }

            return(_curlRequest.ToString());
        }
Example #7
0
        public void FindAllAsync_AppendsMongoProductsToGameRoots_WhenNotFoundDetailsInSql()
        {
            var testRoots = CreateGameRoots();
            var products  = CreateProducts();

            A.CallTo(() => _gameRootPipeline.ExecuteAsync()).Returns(testRoots);
            A.CallTo(() => _productPipeline.ExecuteAsync()).Returns(products);
            A.CallTo(() => _mapper.Map <GameDetails>(A <Product> ._)).Returns(new GameDetails());

            var roots = _gameRootAggregator.FindAllAsync(new GameFilterData()).Result;
            var allNotEmptyDetails = roots.All(gr => gr.Details != null);

            allNotEmptyDetails.Should().BeTrue();
        }
 public Task ExecuteAsync(T handler, IKeyValueCollection customValues)
 {
     EnsureGeneratedPipeline();
     return(generatedPipeline.ExecuteAsync(handler, customValues));
 }
        public void Invoke()
        {
            T instance = handlerFactory.Create();

            pipeline.ExecuteAsync(instance);
        }
Example #10
0
 /// <summary>
 /// Executes pipeline on <paramref name="handler"/> wiht custom values.
 /// </summary>
 /// <param name="handler">Handler instance to execute pipeline on.</param>
 /// <returns>Continuation task.</returns>
 public static Task ExecuteAsync <T>(this IPipeline <T> pipeline, T handler)
 {
     Ensure.NotNull(pipeline, "pipeline");
     return(pipeline.ExecuteAsync(handler, new KeyValueCollection()));
 }