public async Task GetByCatgoryShouldReturnTheCorrectArticles() { this.Setup(); var repo = new Mock <IDeletableEntityRepository <BlogArticle> >(); repo.Setup(x => x.AllAsNoTracking()).Returns(this.articleList.AsQueryable()); repo.Setup(x => x.AddAsync(It.IsAny <BlogArticle>())).Callback( (BlogArticle article) => this.articleList.Add(article)); var categoryRepo = new Mock <IDeletableEntityRepository <BlogCategory> >(); var articlesService = new ArticlesService(repo.Object, categoryRepo.Object); await articlesService.CreateAsync(this.testArticle, "testUser"); await articlesService.CreateAsync(this.testArticle, "testUser"); var returnedArticle = articlesService.GetByCategory <ArticleViewModel>(1, 10, 1).FirstOrDefault(); Assert.Equal("test", returnedArticle.Title); }