示例#1
0
        public void PagingTest()
        {
            var bp = new CatsBP();
            for (var i = 0; i < 10; i++)
            {
                bp.NewCat();
            }
            var session = NHibernateHelper.GetCurrentSession();
            var q = session.CreateQuery("select c from Cat as c order by c.Id");
            q.SetMaxResults(6);
            q.SetFirstResult(5);
            var result = q.List<Cat>();
            Assert.IsNotNull(result, "没有查询出结果");
            Assert.AreEqual(5, result.Count, string.Format("分页返回记录数不正确,期望值为{0},实际值为{1}", 5, result.Count));


            result = (from c in session.Query<Cat>()
                      orderby c.Id
                      select c).Skip(5).Take(6).ToList();

            Assert.IsNotNull(result, "没有查询出结果");
            Assert.AreEqual(5, result.Count);

        }
示例#2
0
 public void NewCatTest()
 {
     var target = new CatsBP(); // TODO: Initialize to an appropriate value
     target.NewCat();
     //Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
示例#3
0
 public void CreateDataBase()
 {
     var target = new CatsBP();
     target.CreateSchema();
 }