public IHttpActionResult SearchByPrice(PriceSearchRequestDto dto) { ISearchingCriterion <Offer> criterion = OffersSearchingCriteriaFactory.CreatePriceSearchingCriterion(dto.MinimalPrice, dto.MaximalPrice); return(Search(dto.Username, new[] { criterion }, dto.SortType, dto.SortBy)); }
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); }
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()); }