public override ActionResult GetListWithPager(GetArticlesListQuery filters) { var category = _categoryRepository.Get(it => it.Code == ForCategoryCode); filters.CategoryId = category == null ? "-" : category.Id; return(base.GetListWithPager(filters)); }
public async Task GetArticlesListQueryHandlerTest_Succes() { var sut = new GetArticlesListQueryHandler(db); var pagingModel = new PagingModel { Field = "Username" }; var order = new Order(); pagingModel.Order = order; pagingModel.PageNumber = 1; pagingModel.PageSize = 2; var getArticleQuery = new GetArticlesListQuery(pagingModel); var result = await sut.Handle(getArticleQuery, CancellationToken.None); Assert.IsType <ArticlesListViewModel>(result); Assert.NotNull(result); Assert.Equal(2, result.Articles.Count); }