示例#1
0
        static void TestDBI_T_strength_T5()
        {
            Console.WriteLine("  --START: TestDBI_T_strength_T5");

            //Construct a brand new myTable in RAM
            SQLServerDB.strength_Table myTable = new SQLServerDB.strength_Table();
            myTable.itemList = new List <strength>()
            {
                //strength(String val_notes, String val_processArea, String val_specificGoal, String val_specificPractice, String val_genericGoal, String val_genericPractice,   int val_projectId)
                new strength("notes_1", "pa_1", "sg_1", "sp_1", "gg_1", "gp_1", 404),
                new strength("notes_2", "pa_1", "sg_1", "sp_1", "gg_1", "gp_1", 404),
                new strength("notes_3", "pa_1", "sg_1", "sp_1", "gg_1", "gp_1", 404),
                new strength("notes_4", "pa_1", "sg_1", "sp_1", "gg_1", "gp_1", 404),
                new strength("notes_5", "pa_1", "sg_1", "sp_1", "gg_1", "gp_1", 404)
            };
            int iRowsStart = myTable.itemList.Count;

            //Count SQLServerDB strength table rows before clearing
            int iRows1 = myTable.CountRows();

            Console.WriteLine("myTable.CountRows = " + iRows1.ToString());

            myTable.Clear_Database_Table();
            int iRows2 = myTable.CountRows();

            if (iRows2 != 0)
            {
                Console.WriteLine("Error! iRows2=" + iRows2 + ".  After Clear_Database_Table should be zero");
            }

            myTable.WriteItemListToDatabase();

            int iRows3 = myTable.CountRows();

            if (iRows3 != iRowsStart)
            {
                Console.WriteLine("Error! iRows3=" + iRows3 + ".  After WriteItemListToDatabase should be " + iRowsStart);
            }
            else
            {
                Console.WriteLine("OK. CountRows=" + iRows3 + " After WriteItemListToDatabase");
            }

            Util.pause("examine table content with SSMS");

            Util.pause("before table query by projectID");
            int iProjectCount_404 = myTable.CountRows_By_projectId(404);

            if (iProjectCount_404 != iRowsStart)
            {
                Console.WriteLine("ERROR.  iProjectCount_404=" + iProjectCount_404 + ". Expected " + iRowsStart);
            }
            else
            {
                Console.WriteLine("OK. CountRows=" + iProjectCount_404 + " After WriteItemListToDatabase");
            }
            Util.pause();

            Console.WriteLine("  --DONE: TestDBI_T_strength_T5");
        }