public IEnumerable <NewsViewModel.Preview> LoadNews(Int32 skip = 0, Int32 take = 5)
        {
            YoumotoDbContext context = this.context ?? new YoumotoDbContext();

            return(NewsPersister
                   .LoadLatestPaged(context, skip, take)
                   .Select(runner => new NewsViewModel.Preview(runner)));
        }
Exemple #2
0
        public void LoadNewsPagedSecoundChunk()
        {
            Int32 newsCount = 5;

            using (var context = new YoumotoDbContext(Effort.DbConnectionFactory.CreateTransient()))
            {
                List <News> testNews = this.CreateTestNews(newsCount, context);

                context.SaveChanges();

                var paged = NewsPersister.LoadLatestPaged(context, 2, 2).ToList();

                Assert.AreEqual(2, paged.Count());
                Assert.AreEqual(testNews[newsCount - 3].Guid, paged[0].Guid);
                Assert.AreEqual(testNews[newsCount - 4].Guid, paged[1].Guid);
            }
        }