Ejemplo n.º 1
0
        public void TestDelete()
        {
            var test = TestExten.GetModel("1=1", "id");
            var row  = test.Delete();

            Assert.AreEqual(1, row);
        }
Ejemplo n.º 2
0
        public void TestGetModelByPrimary()
        {
            var data = TestExten.GetModel("1=1", "id");
            var test = TestExten.GetModel(data.id);

            Assert.IsNotNull(test);
        }
Ejemplo n.º 3
0
        public void TestGetList()
        {
            var list = TestExten.GetList("name is not null");

            Assert.IsNotNull(list);
            Assert.IsTrue(list.Count > 0);
        }
Ejemplo n.º 4
0
        public void TestDeleteListByPrimaryArray()
        {
            var list = TestExten.GetList("1=1").Take(2).ToList();
            var row  = TestExten.Delete(list.Select(m => m.id).ToArray());

            Assert.AreEqual(list.Count, row);
        }
Ejemplo n.º 5
0
        public void TestDeleteList()
        {
            var list = TestExten.GetList("1=1").Take(3).ToList();
            var row  = list.Delete();

            Assert.AreEqual(list.Count, row);
        }
Ejemplo n.º 6
0
        public void TestDeleteByPrimary()
        {
            var test = TestExten.GetModel("1=1", "id");
            var row  = TestExten.Delete(test.id);

            Assert.AreEqual(1, row);
        }
Ejemplo n.º 7
0
        public void TestUpdate()
        {
            var test = TestExten.GetModel("1=1", "id");

            test.Time = DateTime.Now;
            var row = test.Update();

            Assert.AreEqual(1, row);
        }
Ejemplo n.º 8
0
        public void TestUpdateList()
        {
            var list = TestExten.GetList("1=1").Take(3).ToList();

            for (var i = 0; i < list.Count; i++)
            {
                list[i].Time = DateTime.Now;
            }
            var row = list.Update();

            Assert.AreEqual(list.Count, row);
        }
Ejemplo n.º 9
0
        public void TestPageList()
        {
            var  index   = 2;
            var  size    = 3;
            var  list    = TestExten.GetPageList(index, size);
            var  tarlist = TestExten.GetList("1=1").OrderByDescending(m => m.id).Skip((index - 1) * size).Take(size).ToList();
            bool valid   = true;
            var  actual  = list.Data as List <Entity.dapper_test.Test>;

            for (var i = 0; i < actual.Count; i++)
            {
                if (!tarlist[i].id.Equals(actual[i].id))
                {
                    valid = false;
                }
            }
            Assert.IsTrue(valid);
        }
Ejemplo n.º 10
0
        public void TestGetModel()
        {
            var test = TestExten.GetModel("1=1", "id desc");

            Assert.IsNotNull(test);
        }