Ejemplo n.º 1
0
        public void testAbstractFind()
        {
            // 抽象基类是 TAbCategory

            List <TAbNewCategory> list = db.findAll <TAbNewCategory>();

            Assert.AreEqual(9, list.Count);

            Assert.AreEqual("标题啊_1", list[0].Title);

            List <TAbNewCategory2> list2 = db.findAll <TAbNewCategory2>();

            Assert.AreEqual(9, list2.Count);

            Assert.AreEqual("标题啊2_1", list2[0].Title2);


            TAbNewCategory c = db.findById <TAbNewCategory>(2);

            Assert.IsNotNull(c);
            Assert.AreEqual(4, c.Hits);

            List <TAbNewCategory> qlist = db.find <TAbNewCategory>("Hits=6").list();

            Assert.AreEqual(1, qlist.Count);
        }
Ejemplo n.º 2
0
        private void insertAbstractTest()
        {
            for (int i = 1; i < 10; i++)
            {
                TAbNewCategory abCategory = new TAbNewCategory();
                abCategory.Name  = "我是继承的名称_" + i;
                abCategory.Title = "标题啊_" + i;
                abCategory.Hits  = 2 + i;
                db.insert(abCategory);
                Assert.AreEqual(abCategory.Id, i);

                TAbNewCategory2 abCategory2 = new TAbNewCategory2();
                abCategory2.Name   = "我是继承的名称2_" + i;
                abCategory2.Title2 = "标题啊2_" + i;
                db.insert(abCategory2);
                Assert.AreEqual(abCategory2.Id, i);
            }
        }
Ejemplo n.º 3
0
        private void insertAbstractTest()
        {
            for (int i = 1; i < 10; i++) {
                TAbNewCategory abCategory = new TAbNewCategory();
                abCategory.Name = "���Ǽ̳е�����_" + i;
                abCategory.Title = "���Ⱑ_" + i;
                abCategory.Hits = 2 + i;
                db.insert( abCategory );
                Assert.AreEqual( abCategory.Id, i );

                TAbNewCategory2 abCategory2 = new TAbNewCategory2();
                abCategory2.Name = "���Ǽ̳е�����2_" + i;
                abCategory2.Title2 = "���Ⱑ2_" + i;
                db.insert( abCategory2 );
                Assert.AreEqual( abCategory2.Id, i );
            }
        }