Exemplo n.º 1
0
        public void Save2DB(FctTest fctTest)
        {
            TMain main = new TMain();
            main.Key = fctTest.Key;
            main.Start = fctTest.StartTime;
            main.RunningTime = fctTest.RunningTime;
            main.Tester = fctTest.Tester;
            main.TestType = TEST_TYPE_FCT;
            main.IsPass = fctTest.IsPass() ? TEST_RESULT_PASS : TEST_RESULT_FAIL;
            main.Note = fctTest.FinishReason;
            mainADO.Insert(main);

            Dictionary<Board, List<ComponentType>> dicts = fctTest.Cabinet.GetFctTestedComponentTypesDicts();
            foreach (var b in dicts.Keys)
            {
                TBoard board = new TBoard();
                board.Id = Summer.System.Util.DbHelper.GenerateKey();
                board.Key = fctTest.Key;
                board.Name = b.EqName;
                board.Type = b.BoardType;
                board.Component = "";
                List<ComponentType> list = dicts[b];
                foreach (var ct in list)
                {
                    board.Component += ct.EqName + " ";
                }
                board.Sn = b.FctTestSN;
                board.IsPass = b.IsFctTestPassed() ? TEST_RESULT_PASS : TEST_RESULT_FAIL;
                boardADO.Insert(board);
            }
        }
Exemplo n.º 2
0
        public void FindCondition_WithEqual()
        {
            TArticle art = new TArticle();

            art.Member     = TMember.findById(8);
            art.Cat        = TCat.findById(7);
            art.Board      = TBoard.findById(3);
            art.Author     = "163羽化";
            art.Title      = "myurl=www.163.com";
            art.CreateTime = DateTime.Now;
            art.ChannelId  = 4;
            art.IsDelete   = 0;
            art.OrderId    = 15;

            art.insert();

            IList <TArticle> articles = TArticle.find("Title=:t").set("t", art.Title).list();

            Assert.AreEqual(1, articles.Count);

            logger.Info("===========================================================================");
            IList <TArticle> articles2 = TArticle.find("Title='" + art.Title + "'").list();

            Assert.AreEqual(1, articles2.Count);
        }
Exemplo n.º 3
0
        public void FindById_ContextCache()
        {
            ConsoleTitleUtil.ShowTestTitle("FindById_ContextCache");

            //复杂关联find
            TArticle art = TArticle.findById(1);

            Console.WriteLine("article 1 title is : " + art.Title);
            Assert.AreEqual("狂人日记", art.Title);

            //一级缓存
            TMember member = TMember.findById(13);

            Console.WriteLine("member 13 name is : " + member.Name);
            Assert.AreEqual("袁世凯", member.Name);

            TCat cat = TCat.findById(8);

            Console.WriteLine("cat 8 name is " + cat.Name);
            Assert.AreEqual("武侠小说", cat.Name);

            TBoard board = TBoard.findById(9);

            Console.WriteLine("board 9 name is : " + board.Name);
            Assert.AreEqual("board_互联网络", board.Name);
        }
Exemplo n.º 4
0
        //------------------------- Insert -------------------------

        public void InsertArticle()
        {
            ConsoleTitleUtil.ShowTestTitle("InsertArticle");

            TArticle art = new TArticle();

            art.Member     = TMember.findById(13);
            art.Cat        = TCat.findById(8);
            art.Board      = TBoard.findById(9);
            art.Author     = "54鲁迅";
            art.Title      = "狂人日记";
            art.CreateTime = DateTime.Now;
            art.ChannelId  = 18;
            art.IsDelete   = 0;
            art.OrderId    = 5;
            art.insert();
            int id = art.Id;

            art.Member     = TMember.findById(2);
            art.Cat        = TCat.findById(10);
            art.Board      = TBoard.findById(11);
            art.Author     = "周做人";
            art.Title      = "论雷锋大的倒掉";
            art.CreateTime = DateTime.Now;
            art.ChannelId  = 12;
            art.IsDelete   = 0;
            art.OrderId    = 8;
            art.insert();
            id = id + 1;
            Assert.AreEqual(id, art.Id);

            art.Member     = TMember.findById(7);
            art.Cat        = TCat.findById(4);
            art.Board      = TBoard.findById(4);
            art.Author     = "嵇康";
            art.Title      = "与善举员绝交数";
            art.CreateTime = DateTime.Now;
            art.ChannelId  = 4;
            art.IsDelete   = 0;
            art.OrderId    = 9;
            art.insert();
            id = id + 1;
            Assert.AreEqual(id, art.Id);

            art.Member     = TMember.findById(8);
            art.Cat        = TCat.findById(7);
            art.Board      = TBoard.findById(3);
            art.Author     = "羽化";
            art.Title      = "许三管买血迹";
            art.CreateTime = DateTime.Now;
            art.ChannelId  = 4;
            art.IsDelete   = 0;
            art.OrderId    = 15;
            art.insert();
            id = id + 1;
            Assert.AreEqual(id, art.Id);

            Console.WriteLine("添加 article 成功!");
        }
Exemplo n.º 5
0
        public void ZDelete()
        {
            ConsoleTitleUtil.ShowTestTitle("Delete");


            int    id = 2;
            TBoard bd = TBoard.findById(id);

            Assert.IsNotNull(bd);
            Assert.AreEqual(id, bd.Id);
            db.delete(bd);

            TBoard myboard = TBoard.findById(id);

            Assert.IsNull(myboard);
        }
Exemplo n.º 6
0
        public void InsertBoard()
        {
            ConsoleTitleUtil.ShowTestTitle("InsertBoard");


            TBoard board = new TBoard();

            board.Name = "board_国内新闻";
            board.insert();

            board.Name = "board_国际新闻";
            board.insert();

            board.Name = "board_娱乐电影";
            board.insert();

            board.Name = "board_音像世界";
            board.insert();

            board.Name = "board_游戏广场";
            board.insert();

            board.Name = "board_文学艺术";
            board.insert();

            board.Name = "board_电视剧本";
            board.insert();

            board.Name = "board_武侠小说";
            board.insert();

            board.Name = "board_互联网络";
            board.insert();

            board.Name = "board_软件服务";
            board.insert();

            board.Name = "board_笑话幽默";
            board.insert();

            board.Name = "board_金融期货";
            board.insert();

            Console.WriteLine("添加 board 成功!");
        }
Exemplo n.º 7
0
        public void findPage()
        {
            int pageSize = 5;

            //------------- 第1页 ---------------
            int current = 1;

            CurrentRequest.setCurrentPage(current);

            DataPage <TBoard> list = TBoard.findPage("Id>0", pageSize);

            Assert.AreEqual(current, list.Current);
            Assert.AreEqual(12, list.RecordCount);
            Assert.AreEqual(3, list.PageCount);
            Assert.AreEqual(pageSize, list.Size);
            Assert.AreEqual(pageSize, list.Results.Count);

            //------------- 第2页 ---------------
            current = 2;
            CurrentRequest.setCurrentPage(current);

            list = TBoard.findPage("Id>0", pageSize);

            Assert.AreEqual(current, list.Current);
            Assert.AreEqual(12, list.RecordCount);
            Assert.AreEqual(3, list.PageCount);
            Assert.AreEqual(pageSize, list.Size);
            Assert.AreEqual(pageSize, list.Results.Count);


            //------------- 第3页 ---------------

            current = 3;
            CurrentRequest.setCurrentPage(current);

            list = TBoard.findPage("Id>0", pageSize);

            Assert.AreEqual(current, list.Current);
            Assert.AreEqual(12, list.RecordCount);
            Assert.AreEqual(3, list.PageCount);
            Assert.AreEqual(pageSize, list.Size);
            Assert.AreEqual(2, list.Results.Count);
        }
Exemplo n.º 8
0
        public void ZDeleteBatch()
        {
            ConsoleTitleUtil.ShowTestTitle("DeleteBatch");

            int count  = TBoard.count();
            int intVal = 6;

            String whereStr = "Id>=" + intVal;
            int    wcount   = TBoard.count(whereStr);

            TBoard.deleteBatch(whereStr);

            int bdCount = TBoard.count();

            Assert.AreEqual((count - wcount), bdCount);

            TBoard bd = TBoard.findById(intVal + intVal);

            Assert.IsNull(bd);

            bd = TBoard.findById(intVal + intVal);
            Assert.IsNull(bd);
        }
Exemplo n.º 9
0
        public void Save2DB(GeneralTest generalTest)
        {
            TMain main = new TMain();
            main.Key = generalTest.Key;
            main.Start = generalTest.StartTime;
            main.RunningTime = generalTest.RunningTime;
            main.Tester = generalTest.Tester;
            main.TestType = TEST_TYPE_GENERAL;
            main.IsPass = generalTest.IsPass() ? TEST_RESULT_PASS : TEST_RESULT_FAIL;
            main.Note = generalTest.FinishReason;
            mainADO.Insert(main);

            List<Board> boards = generalTest.Cabinet.GetGeneralTestBoardsList();
            foreach (var b in boards)
            {
                TBoard board = new TBoard();
                board.Id = Summer.System.Util.DbHelper.GenerateKey();
                board.Key = generalTest.Key;
                board.Name = b.EqName;
                board.Type = b.BoardType;
                board.Component = ""; //综合测试没有组件,所以设置为空
                board.Sn = b.GeneralTestSN;
                board.IsPass = b.IsGeneralTestPassed ? TEST_RESULT_PASS : TEST_RESULT_FAIL;
                boardADO.Insert(board);
            }
        }
Exemplo n.º 10
0
        public void InsertBoard()
        {
            ConsoleTitleUtil.ShowTestTitle( "InsertBoard" );

            TBoard board = new TBoard();
            board.Name = "board_��������";
            db.insert( board );

            board.Name = "board_��������";
            db.insert( board );

            board.Name = "board_���ֵ�Ӱ";
            db.insert( board );

            board.Name = "board_��������";
            db.insert( board );

            board.Name = "board_��Ϸ�㳡";
            db.insert( board );

            board.Name = "board_��ѧ����";
            db.insert( board );

            board.Name = "board_���Ӿ籾";
            db.insert( board );

            board.Name = "board_����С˵";
            db.insert( board );

            board.Name = "board_��������";
            db.insert( board );

            board.Name = "board_�������";
            db.insert( board );

            board.Name = "board_Ц����Ĭ";
            db.insert( board );

            board.Name = "board_�����ڻ�";
            db.insert( board );

            Console.WriteLine( "��� board �ɹ���" );
        }
Exemplo n.º 11
0
        public void findPage()
        {
            int pageSize = 5;

            //------------- 第1页 ---------------
            int current = 1;

            CurrentRequest.setCurrentPage(current);

            DataPage <TBoard> list = TBoard.findPage("Id>0", pageSize);

            Assert.AreEqual(current, list.Current);
            Assert.AreEqual(12, list.RecordCount);
            Assert.AreEqual(3, list.PageCount);
            Assert.AreEqual(pageSize, list.Size);
            Assert.AreEqual(pageSize, list.Results.Count);

            //------------- 第2页 ---------------
            current = 2;
            CurrentRequest.setCurrentPage(current);

            list = TBoard.findPage("Id>0", pageSize);

            Assert.AreEqual(current, list.Current);
            Assert.AreEqual(12, list.RecordCount);
            Assert.AreEqual(3, list.PageCount);
            Assert.AreEqual(pageSize, list.Size);
            Assert.AreEqual(pageSize, list.Results.Count);


            //------------- 第3页 ---------------

            current = 3;
            CurrentRequest.setCurrentPage(current);

            list = TBoard.findPage("Id>0", pageSize);

            Assert.AreEqual(current, list.Current);
            Assert.AreEqual(12, list.RecordCount);
            Assert.AreEqual(3, list.PageCount);
            Assert.AreEqual(pageSize, list.Size);
            Assert.AreEqual(2, list.Results.Count);


            //------------- 第n页 ---------------

            for (int i = 0; i < 100; i++)
            {
                TBoard board = new TBoard();
                board.Name = "board_pageTest_" + i;
                board.insert();
            }


            current = 2;

            CurrentRequest.setCurrentPage(current);

            list = TBoard.findPage("Id>0 order by Id asc", 10);
            Assert.AreEqual(current, list.Current);

            Assert.AreEqual(112, list.RecordCount);
            Assert.AreEqual(12, list.PageCount);
            Assert.AreEqual(10, list.Results.Count);

            String ids = "";

            foreach (TBoard bd in list.Results)
            {
                ids += bd.Id + ", " + bd.Name + Environment.NewLine;
            }
            Console.WriteLine(ids);

            String bar = strUtil.ParseHtml(list.PageBar).Replace("&nbsp;", ",");

            Console.WriteLine(bar);
        }
Exemplo n.º 12
0
 public yuBoardViewModel()
 {
     iv_Board = new TBoard();
 }
Exemplo n.º 13
0
 public yuBoardViewModel(TBoard p)
 {
     iv_Board = p;
 }
Exemplo n.º 14
0
        public void InsertBoard()
        {
            ConsoleTitleUtil.ShowTestTitle( "InsertBoard" );

            TBoard board = new TBoard();
            board.Name = "board_国内新闻";
            db.insert( board );

            board.Name = "board_国际新闻";
            db.insert( board );

            board.Name = "board_娱乐电影";
            db.insert( board );

            board.Name = "board_音像世界";
            db.insert( board );

            board.Name = "board_游戏广场";
            db.insert( board );

            board.Name = "board_文学艺术";
            db.insert( board );

            board.Name = "board_电视剧本";
            db.insert( board );

            board.Name = "board_武侠小说";
            db.insert( board );

            board.Name = "board_互联网络";
            db.insert( board );

            board.Name = "board_软件服务";
            db.insert( board );

            board.Name = "board_笑话幽默";
            db.insert( board );

            board.Name = "board_金融期货";
            db.insert( board );

            Console.WriteLine( "添加 board 成功!" );
        }
Exemplo n.º 15
0
        public void findPage()
        {
            int pageSize = 5;

            //------------- 第1页 ---------------
            int current = 1;
            CurrentRequest.setCurrentPage( current );

            DataPage<TBoard> list = TBoard.findPage( "Id>0", pageSize );

            Assert.AreEqual( current, list.Current );
            Assert.AreEqual( 12, list.RecordCount );
            Assert.AreEqual( 3, list.PageCount );
            Assert.AreEqual( pageSize, list.Size );
            Assert.AreEqual( pageSize, list.Results.Count );

            //------------- 第2页 ---------------
            current = 2;
            CurrentRequest.setCurrentPage( current );

            list = TBoard.findPage( "Id>0", pageSize );

            Assert.AreEqual( current, list.Current );
            Assert.AreEqual( 12, list.RecordCount );
            Assert.AreEqual( 3, list.PageCount );
            Assert.AreEqual( pageSize, list.Size );
            Assert.AreEqual( pageSize, list.Results.Count );

            //------------- 第3页 ---------------

            current = 3;
            CurrentRequest.setCurrentPage( current );

            list = TBoard.findPage( "Id>0", pageSize );

            Assert.AreEqual( current, list.Current );
            Assert.AreEqual( 12, list.RecordCount );
            Assert.AreEqual( 3, list.PageCount );
            Assert.AreEqual( pageSize, list.Size );
            Assert.AreEqual( 2, list.Results.Count );

            //------------- 第n页 ---------------

            for (int i = 0; i < 100; i++) {

                TBoard board = new TBoard();
                board.Name = "board_pageTest_"+ i;
                board.insert();
            }

            current = 2;

            CurrentRequest.setCurrentPage( current );

            list = TBoard.findPage( "Id>0 order by Id asc", 10 );
            Assert.AreEqual( current, list.Current );

            Assert.AreEqual( 112, list.RecordCount );
            Assert.AreEqual( 12, list.PageCount );
            Assert.AreEqual( 10, list.Results.Count );

            String ids = "";
            foreach (TBoard bd in list.Results) {
                ids += bd.Id+ ", " + bd.Name + Environment.NewLine;
            }
            Console.WriteLine( ids );

            String bar = strUtil.ParseHtml( list.PageBar ).Replace("&nbsp;", ",");
            Console.WriteLine( bar );
        }