コード例 #1
0
        public IHttpActionResult SearchByPrice(PriceSearchRequestDto dto)
        {
            ISearchingCriterion <Offer> criterion =
                OffersSearchingCriteriaFactory.CreatePriceSearchingCriterion(dto.MinimalPrice, dto.MaximalPrice);

            return(Search(dto.Username, new[] { criterion }, dto.SortType, dto.SortBy));
        }
コード例 #2
0
        public async Task <IEnumerable <Offer> > SearchByPriceAsync(string username, double?minimalPrice, double?maximalPrice,
                                                                    SortType sortType, SortBy sortBy)
        {
            PriceSearchRequestDto dto = new PriceSearchRequestDto()
            {
                Username     = username,
                MinimalPrice = minimalPrice,
                MaximalPrice = maximalPrice,
                SortBy       = sortBy,
                SortType     = sortType
            };
            var res = await Post <PriceSearchRequestDto, SearchResultDto>("price", dto);

            return(res.Offers);
        }
コード例 #3
0
        public void SearchByPriceTest1()
        {
            PriceSearchRequestDto dto = new PriceSearchRequestDto()
            {
                MinimalPrice = 300,
                MaximalPrice = 350,
                SortBy       = SortBy.Price,
                SortType     = SortType.Ascending,
                Username     = "******"
            };

            IHttpActionResult result = _controller.SearchByPrice(dto);
            var contentResult        = result as OkNegotiatedContentResult <SearchResultDto>;

            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(1, contentResult.Content.Offers.Count());
        }