コード例 #1
0
        public void GetAll_OrderByDescending()
        {
            var ar0 = new Article
                          {
                              Id = Guid.NewGuid()
                          };

            var ar1 = new Article
                          {
                              Id = Guid.NewGuid()
                          };

            var ar2 = new Article
                          {
                              Id = Guid.NewGuid()
                          };

            using (_mockRepository.Record())
            {
                _articleRepository.Stub(x => x.Table)
                    .Return(new List<Article> { ar1, ar2, ar0 }.AsQueryable());
            }

            var result = _articleService.GetAll(0, 10);

            Assert.AreEqual(result[0].Id, ar1.Id);
            Assert.AreEqual(result[1].Id, ar2.Id);
            Assert.AreEqual(result[2].Id, ar0.Id);
        }
コード例 #2
0
 public static Article ToEntity(this ArticleModel model, Article destination)
 {
     return Mapper.Map(model, destination);
 }