Example #1
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 成功!" );
        }
Example #2
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 );
        }
Example #3
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 成功!");
        }
Example #4
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 �ɹ���" );
        }
Example #5
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);
        }