How do i write a testcase to the below info thanks John.
public static bool Update(Group Obj)
{
bool results = true;
string sqlStr = String.Empty;
DataSet data = new DataSet();
int count = 0;
sqlStr = "SELECT COUNT(*) ROW_COUNT FROM GRP where GRP_ID = " + "'" + Obj.GroupId + "'";
ODP_DataClient service = new ODP_DataClient();
string dbConn = GetConnData();
data = service.GetDataSet(dbConn, sqlStr);
if (data.Tables[0].Rows.Count > 0)
{
DataRow row = data.Tables[0].Rows[0];
count = Convert.ToInt32(row["ROW_COUNT"]);
}
if (count.Equals(0))
{
sqlStr = "INSERT INTO GRP (GRP_ID, GRP_NAME,GRP_WORK_LOC, GRP_UPD_USR_ID, GRP_UPD_DATETIME)";
sqlStr = sqlStr + " VALUES(" + "'" + Obj.GroupId + "'," + "'" + Obj.GroupName + "'," + "'" + Obj.WorkLocation + "','" + Obj.UpdateUserId + "', SYSDATE" + ")";
}
else
{
sqlStr = "UPDATE GRP SET GRP_NAME = '" + Obj.GroupName + "'," + " GRP_WORK_LOC = '" + Obj.WorkLocation + "', GRP_UPD_DATETIME = SYSDATE ";
sqlStr = sqlStr + " WHERE GRP_ID = '" + Obj.GroupId + "'";
}
results = service.ExecuteNonQuery(dbConn, sqlStr);
return results;
}