/// <summary> /// test 1 /// Testing the creation of the database /// </summary> /// <returns></returns> private String Test1() { Message m1 = new Message(); m1.TestID = 1; m_QueryResult = m_MockRootServerTestObj.ExecQuery("CREATE DB first_db", m_Token); if (m_QueryResult.GetId() == 1) { m1.Passed = false; m1.Msg = " m_MockRootServerTestObj.ExecQuery(CREATE DB first_db) fails"; } else { m1.Passed = true; m1.Msg = " m_MockRootServerTestObj.ExecQuery(CREATE DB first_db) succeeds"; } return m1.ToString(); }
/// <summary> /// test 4 /// Testing the selection query from the database /// </summary> /// <returns></returns> private String Test4() { Message m4 = new Message(); m4.TestID = 4; m_QueryResult = m_MockRootServerTestObj.ExecQuery(@"SELECT * FROM first_db.test_table", m_Token); if (m_QueryResult.GetId() == 1) { m4.Passed = false; m4.Msg = " m_MockRootServerTestObj.ExecQuery(SELECT * FROM first_db.test_table) fails"; } else { m4.Passed = true; m4.Msg = " m_MockRootServerTestObj.ExecQuery(SELECT * FROM first_db.test_table) succeeds"; } return m4.ToString(); }
/// <summary> /// test 2 /// Testing the creation of the table /// </summary> /// <returns></returns> private String Test2() { Message m2 = new Message(); m2.TestID = 2; m_QueryResult = m_MockRootServerTestObj.ExecQuery("CREATE TABLE first_db.test_table (PRIMARY KEY prim INT, name VARCHAR(32))", m_Token); if (m_QueryResult.GetId() == 1) { m2.Passed = false; m2.Msg = " m_MockRootServerTestObj.ExecQuery(CREATE TABLE first_db.test_table) fails"; } else { m2.Passed = true; m2.Msg = " m_MockRootServerTestObj.ExecQuery(CREATE TABLE first_db.test_table) succeeds"; } return m2.ToString(); }
/// <summary> /// Test 3 /// Testing the insertion of data in the table /// </summary> /// <returns></returns> private String Test3() { Message m3 = new Message(); m3.TestID = 3; m_QueryResult = m_MockRootServerTestObj.ExecQuery("INSERT INTO first_db.test_table (name) VALUES 'user1'", m_Token); if (m_QueryResult.GetId() == 1) { m3.Passed = false; m3.Msg = " m_MockRootServerTestObj.ExecQuery(INSERT INTO first_db.test_table ) fails"; } else { m3.Passed = true; m3.Msg = " m_MockRootServerTestObj.ExecQuery(INSERT INTO first_db.test_table ) succeeds"; } return m3.ToString(); }
/// <summary> /// test 8 /// testing the execution of the query /// </summary> /// <returns></returns> private string Test8() { Message m8 = new Message(); m8.TestID = 8; m_clientapi = new ClientAPI(); m_clientapi.SetRootServer(RootServerUrl); m_clientapi.SetAuthHostAddress(AuthServerUrl); m_clientapi.ConfigClient(); m_QueryObj = m_clientapi.ExecuteQuery("CREATE DB first_db", m_temptoken); if ((m_QueryObj.GetId() == 0) && (m_QueryObj.GetMessage() == "Database is not created")) { m8.Passed = false; m8.Msg = "m_clientapi.ExecuteQuery fails"; } else { m8.Passed = true; m8.Msg = "m_clientapi.ExecuteQuery succeeds"; } return m8.ToString(); }