Пример #1
0
        public void should_return_articles_from_last_page()
        {
            var articlesFromDb = new ArticleBuilder().Build(15).Map();
            List <ArticleDb> filteredArticles = articlesFromDb.Skip(10).Take(5).ToList();

            List <ArticleDb> mappedArticles = null;
            Action <object>  mapArticles    = (list) => { mappedArticles = list as List <ArticleDb>; };

            _articlesRepository.Setup(n => n.Get(null, It.IsAny <Func <IQueryable <ArticleDb>, IOrderedQueryable <ArticleDb> > >(), ""))
            .Returns(articlesFromDb);
            _mapper.Setup(n => n.Map <List <Article> >(It.IsAny <List <ArticleDb> >())).Callback(mapArticles);

            _sut.Get(5, 3);

            mappedArticles.Should().BeEquivalentTo(filteredArticles);
        }