Ejemplo n.º 1
0
        public async Task <IPagedResult <OfferDto> > HandleAsync(BrowseOffers query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }
            var offers = await _repository.BrowseAsync(query);

            return(_mapper.Map <IPagedResult <OfferDto> >(offers));
        }
Ejemplo n.º 2
0
        public void BrowseOffers_UsesQuery_ReturnsResultOfDispatch()
        {
            var query  = new BrowseOffers();
            var result = new Mock <IPagedResult <OfferDto> >(MockBehavior.Strict).Object;

            _dispatcherMock.Setup(d => d.QueryAsync(query)).ReturnsAsync(result).Verifiable();

            var actionResult = _controller.BrowseOffers(query).GetAwaiter().GetResult();

            Assert.AreEqual(result, actionResult);
            _dispatcherMock.Verify();
        }
Ejemplo n.º 3
0
 public async Task <IPagedResult <OfferDto> > BrowseOffers([FromQuery] BrowseOffers query)
 {
     return(await QueryAsync(query));
 }
Ejemplo n.º 4
0
 public async Task <ActionResult <IPagedResult <Offer> > > BrowseOffers([FromQuery] BrowseOffers query)
 => Collection(await _offersService.BrowseOffers(query));