public async Task EssaysTest() { await DbContext.Categories.AddAsync(new Category { Id = ArticleCategory.Essays, Color = "", Label = "", Value = "" }); await DbContext.Categories.AddAsync(new Category { Id = ArticleCategory.Net, Color = "", Label = "", Value = "" }); await DbContext.Articles.AddAsync(new Article { Id = 1, Title = "test1", CategoryId = ArticleCategory.Essays, Status = BaseStatus.Disabled }); await DbContext.Articles.AddAsync(new Article { Id = 2, Title = "test2", CategoryId = ArticleCategory.Essays, Status = BaseStatus.Enabled }); await DbContext.Articles.AddAsync(new Article { Id = 3, Title = "test3", CategoryId = ArticleCategory.Net, Status = BaseStatus.Enabled }); await DbContext.SaveChangesAsync(); var articleService = new ArticleService(DbContext, Mapper); var controller = new ArticleController(articleService, null); var result = await controller.Essays(); var viewReuslt = result as ViewResult; var model = viewReuslt.Model as Pagination <ArticleDto>; Assert.AreEqual(1, model.Data.Count); Assert.AreEqual(2, model.Data[0].Id); }