public async Task SearchEquipmentSize_Call_PagedList_in_Repository() { var bus = A.Fake <IBus>(); var mapper = A.Fake <IMapper>(); var repo = A.Fake <IQueryDataAccess <EquipmentSizeDTO> >(); var appService = new EquipmentSizeApplicationService(bus, repo, mapper); var page = 1; var pageSize = 10; var request = new EquipmentSizeSearchRequest() { Name = "equi", Page = page, PageSize = pageSize }; A.CallTo(() => repo.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().Returns(Task.FromResult(new Query.Common.PagedList <EquipmentSizeDTO>())); //Act var resp = await appService.SearchEquipmentSizeAsync(request); //Assert Assert.NotNull(resp); A.CallTo(() => repo.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().MustHaveHappened(Repeated.NoMoreThan.Once); }
public async Task <ResponseDTO <PagedList <EquipmentSizeDTO> > > SearchEquipmentSizeAsync(EquipmentSizeSearchRequest search) { Expression <Func <EquipmentSizeDTO, bool> > queryFilter = c => c.RowStatus; if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } var equipmentSize = await _equipmentSizeDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <EquipmentSizeDTO>() { Items = equipmentSize.Items, PageSize = equipmentSize.PageSize, Page = equipmentSize.Page, Total = equipmentSize.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <EquipmentSizeDTO> > > Search(EquipmentSizeSearchRequest search) { var resp = await _equipmentSizeApplicationService.SearchEquipmentSizeAsync(search); return(resp); }