//Case 1502: 1.9.3.1_deleteCrossSection_localizer_has_three_parents_and_delete_all_parents
        public void Run_3D_deleteCrossSection_deleteallparents_Case1502()
        {
            int runCount = 0;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "delete_all_cs_shared_localizer");
                CheckPoint pCreate = new CheckPoint("Workflow", "delete_all_cs_shared_localizer");
                r.CheckPoints.Add(pCreate);

                CrossSectionService cs = new CrossSectionService();

                XMLParameterCollection csInputData1 = new XMLParameterCollection();
                XMLParameterCollection csInputData2 = new XMLParameterCollection();
                XMLParameterCollection csInputData3 = new XMLParameterCollection();

                XMLParameter cs1 = new XMLParameter("crosssection");
                XMLParameter cs2 = new XMLParameter("crosssection");
                XMLParameter cs3 = new XMLParameter("crosssection");

                XMLParameter cs1_slicepath = new XMLParameter("slices_path_list");
                XMLParameter cs2_slicepath = new XMLParameter("slices_path_list");
                XMLParameter cs3_slicepath = new XMLParameter("slices_path_list");

                XMLParameter cs1_slices_dicom_info_list = new XMLParameter("slices_dicom_info_list");
                XMLParameter cs2_slices_dicom_info_list = new XMLParameter("slices_dicom_info_list");
                XMLParameter cs3_slices_dicom_info_list = new XMLParameter("slices_dicom_info_list");

                XMLParameter cs1_ps_xml_annotation_list = new XMLParameter("slices_ps_xml_annotation_list");
                XMLParameter cs2_ps_xml_annotation_list = new XMLParameter("slices_ps_xml_annotation_list");
                XMLParameter cs3_ps_xml_annotation_list = new XMLParameter("slices_ps_xml_annotation_list");

                XMLParameter cs1_ps_xml_general_list = new XMLParameter("slices_ps_xml_general_list");
                XMLParameter cs2_ps_xml_general_list = new XMLParameter("slices_ps_xml_general_list");
                XMLParameter cs3_ps_xml_general_list = new XMLParameter("slices_ps_xml_general_list");

                XMLParameter cs1_ps_xml_processing_list = new XMLParameter("slices_ps_xml_processing_list");
                XMLParameter cs2_ps_xml_processing_list = new XMLParameter("slices_ps_xml_processing_list");
                XMLParameter cs3_ps_xml_processing_list = new XMLParameter("slices_ps_xml_processing_list");

                string volume1 = string.Empty;
                string volume2 = string.Empty;
                string volume3 = string.Empty;

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    switch (ids.InputParameters.GetParameter(i).Step)
                    {
                        case "volume1":
                            volume1 = ids.InputParameters.GetParameter(i).Value;
                            break;

                        case "createcs_crosssection":
                            cs1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs3.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs_slices_dicom_info_list":
                            cs1_slices_dicom_info_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs2_slices_dicom_info_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs3_slices_dicom_info_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs_slices_ps_xml_annotation_list":
                            cs1_ps_xml_annotation_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs2_ps_xml_annotation_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs3_ps_xml_annotation_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs_slices_ps_xml_general_list":
                            cs1_ps_xml_general_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs2_ps_xml_general_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs3_ps_xml_general_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs_slices_ps_xml_processing_list":
                            cs1_ps_xml_processing_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs2_ps_xml_processing_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            cs3_ps_xml_processing_list.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs1_crosssection":
                            cs1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs2_crosssection":
                            cs2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs3_crosssection":
                            cs3.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs1_slices_path_list":
                            cs1_slicepath.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs2_slices_path_list":
                            cs2_slicepath.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;
                        case "createcs3_slices_path_list":
                            cs3_slicepath.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                            break;

                    }
                }
                csInputData1.Add(cs1);
                csInputData1.Add(cs1_slicepath);
                csInputData1.Add(cs1_slices_dicom_info_list);
                csInputData1.Add(cs1_ps_xml_annotation_list);
                csInputData1.Add(cs1_ps_xml_general_list);
                csInputData1.Add(cs1_ps_xml_processing_list);

                csInputData2.Add(cs2);
                csInputData2.Add(cs2_slicepath);
                csInputData2.Add(cs2_slices_dicom_info_list);
                csInputData2.Add(cs2_ps_xml_annotation_list);
                csInputData2.Add(cs2_ps_xml_general_list);
                csInputData2.Add(cs2_ps_xml_processing_list);

                csInputData3.Add(cs3);
                csInputData3.Add(cs3_slicepath);
                csInputData3.Add(cs3_slices_dicom_info_list);
                csInputData3.Add(cs3_ps_xml_annotation_list);
                csInputData3.Add(cs3_ps_xml_general_list);
                csInputData3.Add(cs3_ps_xml_processing_list);
                string test = csInputData1.GenerateXML();
                XMLResult rslCreate1 = cs.createCrossSection(volume1, csInputData1);
                XMLResult rslCreate2 = cs.createCrossSection(volume1, csInputData2);
                XMLResult rslCreate3 = cs.createCrossSection(volume1, csInputData3);

                string csid1 = rslCreate1.SingleResult;
                string csid2 = rslCreate2.SingleResult;
                string csid3 = rslCreate3.SingleResult;

                XMLResult rslList = cs.listImagesOfCrossSection(csid1);
                string first_localizer = rslList.SingleResult;

                XMLResult rslDelete1 = cs.deleteCrossSection(csid1);
                XMLResult rslDelete2 = cs.deleteCrossSection(csid2);
                XMLResult rslDelete3 = cs.deleteCrossSection(csid3);

                ImageService imgsvr = new ImageService();
                XMLParameter cInputImage = new XMLParameter("image");
                cInputImage.AddParameter("internal_id", first_localizer);

                XMLResult rslget = imgsvr.getImageInfo(cInputImage);

                if (!rslCreate1.IsErrorOccured && !rslCreate2.IsErrorOccured && !rslCreate3.IsErrorOccured && !rslDelete1.IsErrorOccured && !rslDelete2.IsErrorOccured && !rslDelete3.IsErrorOccured && rslget.Code == 1006)
                {

                    pCreate.Result = TestResult.Pass;
                    pCreate.Outputs.AddParameter("Workflow", "delete all crosssection shared localizer", "OK");

                }
                else
                {
                    pCreate.Result = TestResult.Fail;
                    string msg = "Create:" + rslCreate1.Message + "," + rslCreate2.Message + "," + rslCreate3.Message + ".Delete:" + rslDelete1.Message + rslDelete2.Message + rslDelete3.Message + ". GetImageCode:" + rslget.Code;
                    pCreate.Outputs.AddParameter("Workflow", "delete all crosssection shared localizer", msg);

                }

                SaveRound(r);
                Output();

            }
        }
        // Case 1159: 1.9.3.2_deleteCrossSection
        public void Run_3D_DeleteCrossSection_Case1159()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;

                Round r = this.NewRound(runCount.ToString(), ids.Description);

                try
                {
                    //Input parameters
                    string p_volumeUID = null;
                    XMLParameterCollection p_createCrossSection = new XMLParameterCollection();
                    XMLParameter crosssection = new XMLParameter("crosssection");
                    XMLParameter slicesPathList = new XMLParameter("slices_path_list");
                    XMLParameter slicesPSAnnotationList = new XMLParameter("slices_ps_xml_annotation_list");
                    XMLParameter slicesPSGeneralList = new XMLParameter("slices_ps_xml_general_list");
                    XMLParameter slicesPSProcessingList = new XMLParameter("slices_ps_xml_processing_list");

                    XMLParameter slicesThumbnailList = new XMLParameter("slices_ps_thumbnail_path_list");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "create_volumeUID")
                        {
                            p_volumeUID = ids.InputParameters.GetParameter(i).Value;
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_crosssection")
                        {
                            crosssection.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_path_list")
                        {
                            slicesPathList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_annotation_list")
                        {
                            slicesPSAnnotationList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_general_list")
                        {
                            slicesPSGeneralList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_processing_list")
                        {
                            slicesPSProcessingList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_thumbnail_path_list")
                        {
                            slicesThumbnailList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                    }

                    p_createCrossSection.Add(crosssection);
                    p_createCrossSection.Add(slicesPathList);
                    p_createCrossSection.Add(slicesPSAnnotationList);
                    p_createCrossSection.Add(slicesPSGeneralList);
                    p_createCrossSection.Add(slicesPSProcessingList);
                    p_createCrossSection.Add(slicesThumbnailList);

                    CrossSectionService crossSectionSvc = new CrossSectionService();
                    #region Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection
                    CheckPoint cp_Create = new CheckPoint("Create", "Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection");
                    r.CheckPoints.Add(cp_Create);

                    XMLResult rt_Create = crossSectionSvc.createCrossSection(p_volumeUID, p_createCrossSection);

                    if (rt_Create.IsErrorOccured)
                    {
                        cp_Create.Result = TestResult.Fail;
                        cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns error", rt_Create.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns succeess", rt_Create.Message);

                        //Check the "internal_id" in return is present
                        bool isInternalIDCorrect = true;

                        if (rt_Create.SingleResult == null || rt_Create.SingleResult == String.Empty)
                        {
                            isInternalIDCorrect = false;
                        }

                        if (!isInternalIDCorrect)
                        {
                            cp_Create.Result = TestResult.Fail;
                            cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns wrong internal_id: ", rt_Create.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cp_Create.Result = TestResult.Pass;
                            cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns correct internal_id: ", rt_Create.SingleResult);
                        }
                    }
                    #endregion

                    #region Step 2: Call CrossSectionService.deleteCrossSection to delete the created crosssection
                    string p_crossectionUID = rt_Create.SingleResult;
                    CheckPoint cp_Delete = new CheckPoint("Delete", "Step 2: Call CrossSectionService.deleteCrossSection to delete the created crosssection");
                    r.CheckPoints.Add(cp_Delete);

                    XMLResult rt_Delete = crossSectionSvc.deleteCrossSection(p_crossectionUID);

                    if (rt_Delete.IsErrorOccured)
                    {
                        cp_Delete.Result = TestResult.Fail;
                        cp_Delete.Outputs.AddParameter("Delete", "Delete the created crosssection returns error", rt_Delete.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        //Check the "internal_id" in return is present
                        bool isActuallyDeleted = true;
                        // To add the check

                        if (!isActuallyDeleted)
                        {
                            cp_Delete.Result = TestResult.Fail;
                            cp_Delete.Outputs.AddParameter("Delete", "The crosssection is not corroctly deleted", rt_Delete.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cp_Delete.Result = TestResult.Pass;
                            cp_Delete.Outputs.AddParameter("Delete", "Delete the created crosssection returns succeess", rt_Delete.Message);
                        }
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString());
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }

            Output();
        }
        //Case 1477: 1.9.3.5_getCrossSectionInfo
        //public void Run_3D_CreateVolume_GetVolumeInfo_DeleteVolume_Case1368() //Case 1368: 1.9.1_Create_Get_Delete_Volume_Normal
        //{
        //    int runCount = 0;
        //    foreach (InputDataSet ids in this.Input.DataSets)
        //    {
        //        runCount++;
        //        Round r = this.NewRound(runCount.ToString(), "3D Unit Create_Get_Delete_Volume");
        //        CheckPoint pCreate = new CheckPoint("3D Unit", "3D Unit Create_Get_Delete_Volume");
        //        r.CheckPoints.Add(pCreate);
        //        VolumeService vs = new VolumeService();
        //        XMLParameterCollection cInputData = new XMLParameterCollection();
        //        XMLParameter cSeriesData = new XMLParameter("series");
        //        XMLParameter cVolumeData = new XMLParameter("volume");
        //        XMLParameter cSlicePathData = new XMLParameter("slices_path_list");
        //        string studyUID = string.Empty;
        //        for (int i = 0; i < ids.InputParameters.Count; i++)
        //        {
        //            switch (ids.InputParameters.GetParameter(i).Step)
        //            {
        //                case "na":
        //                    studyUID = ids.InputParameters.GetParameter(i).Value;
        //                    break;
        //                case "series":
        //                    cSeriesData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
        //                    break;
        //                case "volume":
        //                    cVolumeData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
        //                    break;
        //                case "slices_path_list":
        //                    cSlicePathData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
        //                    break;
        //            }
        //        }
        //        cInputData.Add(cSeriesData);
        //        cInputData.Add(cVolumeData);
        //        cInputData.Add(cSlicePathData);
        //        string test = cInputData.GenerateXML();
        //        XMLResult rslCreate = vs.createVolume(studyUID, cInputData);
        //        string volumeID = rslCreate.SingleResult;
        //        XMLParameter filter = new XMLParameter("volume");
        //        filter.AddParameter("internal_id", volumeID);
        //        filter.AddParameter("path_type", "all");
        //        XMLResult rslget = vs.getVolumeInfo(filter);
        //        XMLResult rsldel = vs.deleteVolume(volumeID);
        //        if (!rslCreate.IsErrorOccured && !rslget.IsErrorOccured && !rsldel.IsErrorOccured)
        //        {
        //            pCreate.Result = TestResult.Pass;
        //            pCreate.Outputs.AddParameter("3D Unit", "CRU Volume Success", volumeID);
        //        }
        //        else
        //        {
        //            pCreate.Result = TestResult.Fail;
        //            pCreate.Outputs.AddParameter("3D Unit", "CreateVolume", "Create:" + rslCreate.Message + " Get:" + rslget.Message + " delete:" + rsldel.Message);
        //        }
        //        SaveRound(r);
        //        Output();
        //    }
        //}
        public void Run_3D_GetCrossSectionInfo_Case1477()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;

                Round r = this.NewRound(runCount.ToString(), ids.Description);

                try
                {
                    //Input parameters
                    string p_volumeUID = null;
                    XMLParameterCollection p_createCrossSection = new XMLParameterCollection();
                    XMLParameter crosssection = new XMLParameter("crosssection");
                    XMLParameter slicesPathList = new XMLParameter("slices_path_list");
                    XMLParameter slicesPSAnnotationList = new XMLParameter("slices_ps_xml_annotation_list");
                    XMLParameter slicesPSGeneralList = new XMLParameter("slices_ps_xml_general_list");
                    XMLParameter slicesPSProcessingList = new XMLParameter("slices_ps_xml_processing_list");

                    XMLParameter slicesThumbnailList = new XMLParameter("slices_ps_thumbnail_path_list");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "create_volumeUID")
                        {
                            p_volumeUID = ids.InputParameters.GetParameter(i).Value;
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_crosssection")
                        {
                            crosssection.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_path_list")
                        {
                            slicesPathList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_annotation_list")
                        {
                            slicesPSAnnotationList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_general_list")
                        {
                            slicesPSGeneralList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_processing_list")
                        {
                            slicesPSProcessingList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_thumbnail_path_list")
                        {
                            slicesThumbnailList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                    }

                    p_createCrossSection.Add(crosssection);
                    p_createCrossSection.Add(slicesPathList);
                    p_createCrossSection.Add(slicesPSAnnotationList);
                    p_createCrossSection.Add(slicesPSGeneralList);
                    p_createCrossSection.Add(slicesPSProcessingList);
                    p_createCrossSection.Add(slicesThumbnailList);

                    //Expected values
                    XMLParameter getCrossSectionInfoReturnParam = new XMLParameter("crosssection");
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "getCrossSectionInfo")
                        {
                            // Add the key to check and the expected value
                            getCrossSectionInfoReturnParam.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                    }

                    CrossSectionService crossSectionSvc = new CrossSectionService();
                    #region Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection
                    CheckPoint cp_Create = new CheckPoint("Create", "Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection");
                    r.CheckPoints.Add(cp_Create);

                    XMLResult rt_Create = crossSectionSvc.createCrossSection(p_volumeUID, p_createCrossSection);

                    if (rt_Create.IsErrorOccured)
                    {
                        cp_Create.Result = TestResult.Fail;
                        cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns error", rt_Create.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns succeess", rt_Create.Message);

                        //Check the "internal_id" in return is present
                        bool isInternalIDCorrect = true;

                        if (rt_Create.SingleResult == null || rt_Create.SingleResult == String.Empty)
                        {
                            isInternalIDCorrect = false;
                        }

                        if (!isInternalIDCorrect)
                        {
                            cp_Create.Result = TestResult.Fail;
                            cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns wrong internal_id: ", rt_Create.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cp_Create.Result = TestResult.Pass;
                            cp_Create.Outputs.AddParameter("Create", "Create a new crosssection returns correct internal_id: ", rt_Create.SingleResult);
                        }
                    }
                    #endregion

                    //System.Threading.Thread.Sleep(3000);  // Add for defect EK_HI00167289, remove this after it's fixed.

                    #region Step 2: Call CrossSectionService.GetCrossSectionInfo to get the crosssection info
                    CheckPoint cpGetCrossSectionInfo = new CheckPoint("GetCrossSectionInfo", "Step 2: Call CrossSectionService.GetCrossSectionInfo to get the crosssection info");
                    r.CheckPoints.Add(cpGetCrossSectionInfo);

                    string p_crossSectionUID = rt_Create.SingleResult;
                    XMLResult rtGetCrossSectionInfo = crossSectionSvc.getCrossSectionInfo(p_crossSectionUID);

                    if (rtGetCrossSectionInfo.IsErrorOccured)
                    {
                        cpGetCrossSectionInfo.Result = TestResult.Fail;
                        cpGetCrossSectionInfo.Outputs.AddParameter("GetCrossSectionInfo", "GetCrossSectionInfo returns error", rtGetCrossSectionInfo.Message);

                        goto CLEANUP;
                    }
                    else // Check the return value details
                    {
                        bool isValueEqual = false;
                        bool isKeyShow = false;

                        foreach (XMLParameterNode psNode in getCrossSectionInfoReturnParam.Parameters)
                        {
                            isValueEqual = false;
                            isKeyShow = false;

                            int i = 0;
                            for (i = 0; i < rtGetCrossSectionInfo.MultiResults[0].Parameters.Count; i++)
                            {
                                if (psNode.ParameterName.ToLower() == rtGetCrossSectionInfo.MultiResults[0].Parameters[i].ParameterName.ToLower())
                                {
                                    isKeyShow = true;
                                    isValueEqual = string.Equals(psNode.ParameterValue, rtGetCrossSectionInfo.MultiResults[0].Parameters[i].ParameterValue);
                                    break; // End current for loop to search node
                                }
                            }

                            if (!isValueEqual) // There value is not matched or not found, log fail and then end the compare progress
                            {
                                cpGetCrossSectionInfo.Result = TestResult.Fail;

                                if (isKeyShow)
                                {
                                    cpGetCrossSectionInfo.Outputs.AddParameter("GetCrossSectionInfo", "Check the Cross Section info in getCrossSectionInfo return", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rtGetCrossSectionInfo.MultiResults[0].Parameters[i].ParameterValue);
                                }
                                else
                                {
                                    cpGetCrossSectionInfo.Outputs.AddParameter("GetCrossSectionInfo", "Check the Cross Section info in getCrossSectionInfo return", "The return value does not contain the node: " + psNode.ParameterName);
                                }

                                break; // End current foreach loop, not compare the follwing nodes
                            }
                        }

                        if (isValueEqual)
                        {
                            cpGetCrossSectionInfo.Result = TestResult.Pass;
                            cpGetCrossSectionInfo.Outputs.AddParameter("GetCrossSectionInfo", "Check the Cross Section info in getCrossSectionInfo return", "The return values in getCrossSectionInfo all match the expected");
                        }
                    }
                    #endregion

                CLEANUP:
                    #region Step 3: Clean up, delete the crossSection
                    crossSectionSvc.deleteCrossSection(p_crossSectionUID);
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString());
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }

            Output();
        }
        //Case 1503: 1.9.3.1_createCrossSection_localizer_dicom_series_instance_uid_exist
        public void Run_3D_createCrossSection_localizeruid_exist_Case1503()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;

                Round r = this.NewRound(runCount.ToString(), ids.Description);

                try
                {
                    //Input parameters
                    string crossectionUID_FirstTime = string.Empty;
                    string crossectionUID_SecondTime = string.Empty;

                    string ep_first_localizer_dicom_series_instance_uid = string.Empty;
                    string ep_second_localizer_dicom_series_instance_uid = string.Empty;

                    string p_volumeUID = null;
                    XMLParameterCollection p_createCrossSectionFirstTime = new XMLParameterCollection();
                    XMLParameterCollection p_createCrossSectionSecondTime = new XMLParameterCollection();

                    XMLParameter crosssectionFirstTime = new XMLParameter("crosssection");
                    XMLParameter crosssectionSecondTime = new XMLParameter("crosssection");

                    XMLParameter slicesPathList = new XMLParameter("slices_path_list");
                    XMLParameter slicesPSAnnotationList = new XMLParameter("slices_ps_xml_annotation_list");
                    XMLParameter slicesPSGeneralList = new XMLParameter("slices_ps_xml_general_list");
                    XMLParameter slicesPSProcessingList = new XMLParameter("slices_ps_xml_processing_list");

                    XMLParameter slicesThumbnailList = new XMLParameter("slices_ps_thumbnail_path_list");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "create_volumeUID")
                        {
                            p_volumeUID = ids.InputParameters.GetParameter(i).Value;
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_crossSection")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "slices_dicom_series_instance_uid")
                            {
                                crosssectionFirstTime.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value + "_firsttime", false);
                                crosssectionSecondTime.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value + "_secondtime", false);
                            }
                            else
                            {
                                crosssectionFirstTime.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                                crosssectionSecondTime.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                                if (ids.InputParameters.GetParameter(i).Key == "first_localizer_dicom_series_instance_uid")
                                {
                                    ep_first_localizer_dicom_series_instance_uid = ids.InputParameters.GetParameter(i).Value; // Record the first_localizer_dicom_series_instance_uid value to check later
                                }
                                else if (ids.InputParameters.GetParameter(i).Key == "second_localizer_dicom_series_instance_uid")
                                {
                                    ep_second_localizer_dicom_series_instance_uid = ids.InputParameters.GetParameter(i).Value; // Record the second_localizer_dicom_series_instance_uid value to check later
                                }
                            }
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_path_list")
                        {
                            slicesPathList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_annotation_list")
                        {
                            slicesPSAnnotationList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_general_list")
                        {
                            slicesPSGeneralList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_xml_processing_list")
                        {
                            slicesPSProcessingList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "create_slices_ps_thumbnail_path_list")
                        {
                            slicesThumbnailList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false);
                        }
                    }

                    p_createCrossSectionFirstTime.Add(crosssectionFirstTime);
                    p_createCrossSectionFirstTime.Add(slicesPathList);
                    p_createCrossSectionFirstTime.Add(slicesPSAnnotationList);
                    p_createCrossSectionFirstTime.Add(slicesPSGeneralList);
                    p_createCrossSectionFirstTime.Add(slicesPSProcessingList);
                    p_createCrossSectionFirstTime.Add(slicesThumbnailList);

                    p_createCrossSectionSecondTime.Add(crosssectionSecondTime);
                    p_createCrossSectionSecondTime.Add(slicesPathList);
                    p_createCrossSectionSecondTime.Add(slicesPSAnnotationList);
                    p_createCrossSectionSecondTime.Add(slicesPSGeneralList);
                    p_createCrossSectionSecondTime.Add(slicesPSProcessingList);
                    p_createCrossSectionSecondTime.Add(slicesThumbnailList);

                    //Output parameter

                    CrossSectionService crossSectionSvc = new CrossSectionService();
                    #region Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection
                    CheckPoint cp_Create_FirstTime = new CheckPoint("Create", "Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection");
                    r.CheckPoints.Add(cp_Create_FirstTime);

                    XMLResult rt_Create_FirstTime = crossSectionSvc.createCrossSection(p_volumeUID, p_createCrossSectionFirstTime);

                    if (rt_Create_FirstTime.IsErrorOccured)
                    {
                        cp_Create_FirstTime.Result = TestResult.Fail;
                        cp_Create_FirstTime.Outputs.AddParameter("Create a new crosssection returns error", "Create", rt_Create_FirstTime.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_Create_FirstTime.Outputs.AddParameter("Create  a new crosssection returns succeess", "Create", rt_Create_FirstTime.Message);

                        //Check the "internal_id" in return is present
                        bool isInternalIDCorrect = true;

                        if (rt_Create_FirstTime.SingleResult == null || rt_Create_FirstTime.SingleResult == String.Empty)
                        {
                            isInternalIDCorrect = false;
                        }

                        if (!isInternalIDCorrect)
                        {
                            cp_Create_FirstTime.Result = TestResult.Fail;
                            cp_Create_FirstTime.Outputs.AddParameter("Create  a new crosssection returns wrong internal_id: ", "Create", rt_Create_FirstTime.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cp_Create_FirstTime.Result = TestResult.Pass;
                            cp_Create_FirstTime.Outputs.AddParameter("Create  a new crosssection returns correct internal_id: ", "Create", rt_Create_FirstTime.SingleResult);
                        }
                    }
                    #endregion

                    #region Step 2: Create for the second time to resue the localizer
                    CheckPoint cp_Create_SecondTime = new CheckPoint("Create", "Step 2: Call CrossSectionService.CreateCrossSection agian to create new crosssection, given the same localizer uid"); // Create for the second time to resue the localizer
                    r.CheckPoints.Add(cp_Create_SecondTime);
                    XMLResult rt_Create_SecondTime = crossSectionSvc.createCrossSection(p_volumeUID, p_createCrossSectionSecondTime);

                    if (rt_Create_SecondTime.IsErrorOccured)
                    {
                        cp_Create_SecondTime.Result = TestResult.Fail;
                        cp_Create_SecondTime.Outputs.AddParameter("Create  a new crosssection returns error", "Create", rt_Create_SecondTime.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cp_Create_SecondTime.Outputs.AddParameter("Create  a new crosssection returns succeess", "Create", rt_Create_SecondTime.Message);

                        //Check the "internal_id" in return is present
                        bool isInternalIDCorrect = true;

                        if (rt_Create_SecondTime.SingleResult == null || rt_Create_SecondTime.SingleResult == String.Empty)
                        {
                            isInternalIDCorrect = false;
                        }

                        if (!isInternalIDCorrect)
                        {
                            cp_Create_SecondTime.Result = TestResult.Fail;
                            cp_Create_SecondTime.Outputs.AddParameter("Create  a new crosssection returns wrong internal_id: ", "Create", rt_Create_SecondTime.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cp_Create_SecondTime.Result = TestResult.Pass;
                            cp_Create_SecondTime.Outputs.AddParameter("Create a new crosssection returns correct internal_id: ", "Create", rt_Create_SecondTime.SingleResult);
                        }
                    }
                    #endregion

                    #region Step 3: Check the crossSection info is correct
                    CheckPoint cp_CheckCrossSectionCompleteInfo = new CheckPoint("Create", "Step 3-1: Call CrossSectionService.getCrossSectionCompleteInfo to check the localizer info");
                    r.CheckPoints.Add(cp_CheckCrossSectionCompleteInfo);

                    crossectionUID_FirstTime = rt_Create_FirstTime.SingleResult;
                    crossectionUID_SecondTime = rt_Create_SecondTime.SingleResult;

                    // call getCrossSectionCompleteInfo
                    XMLResult rt_getCrossSectionCompleteInfoForFirstCreate = crossSectionSvc.getCrossSectionCompleteInfo(crossectionUID_FirstTime);
                    XMLResult rt_getCrossSectionCompleteInfoForSecondCreate = crossSectionSvc.getCrossSectionCompleteInfo(crossectionUID_SecondTime);

                    string first_localizer_dicom_series = "<parameter key=\"first_localizer_dicom_series_instance_uid\" value=\"" + ep_first_localizer_dicom_series_instance_uid + "\" />";   //<parameter key="first_localizer_dicom_series_instance_uid" value="%loc1_dicom_series_instance_uid%" />
                    string second_localizer_dicom_series = "<parameter key=\"second_localizer_dicom_series_instance_uid\" value=\"" + ep_second_localizer_dicom_series_instance_uid + "\" />"; //<parameter key="second_localizer_dicom_series_instance_uid" value="%loc2_dicom_series_instance_uid%" />
                    if (rt_getCrossSectionCompleteInfoForFirstCreate.ResultContent.Contains(first_localizer_dicom_series) && rt_getCrossSectionCompleteInfoForFirstCreate.ResultContent.Contains(second_localizer_dicom_series) && rt_getCrossSectionCompleteInfoForSecondCreate.ResultContent.Contains(first_localizer_dicom_series) && rt_getCrossSectionCompleteInfoForSecondCreate.ResultContent.Contains(second_localizer_dicom_series))
                    {
                        cp_CheckCrossSectionCompleteInfo.Outputs.AddParameter("The localizer info in GetCrossSectionCompleteInfo is correct", "GetCrossSectionCompleteInfo", "");
                        cp_CheckCrossSectionCompleteInfo.Result = TestResult.Pass;
                    }
                    else
                    {
                        cp_CheckCrossSectionCompleteInfo.Outputs.AddParameter("The localizer info in GetCrossSectionCompleteInfo is wrong", "GetCrossSectionCompleteInfo", "");
                        cp_CheckCrossSectionCompleteInfo.Result = TestResult.Fail;
                    }
                    cp_CheckCrossSectionCompleteInfo.Outputs.AddParameter("The GetCrossSectionCompleteInfo return for the first CrossSection is: ", "GetCrossSectionCompleteInfo", rt_getCrossSectionCompleteInfoForFirstCreate.ResultContent);
                    cp_CheckCrossSectionCompleteInfo.Outputs.AddParameter("The GetCrossSectionCompleteInfo return for the second CrossSection is: ", "GetCrossSectionCompleteInfo", rt_getCrossSectionCompleteInfoForSecondCreate.ResultContent);

                    // Call listImagesOfCrossSection
                    CheckPoint cp_CheckListImagesOfCrossSection = new CheckPoint("Create", "Step 3-2: Call CrossSectionService.listImagesOfCrossSection to check the localizer info");
                    r.CheckPoints.Add(cp_CheckListImagesOfCrossSection);

                    XMLResult rt_listImagesOfCrossSectionForFirstCreate = crossSectionSvc.listImagesOfCrossSection(crossectionUID_FirstTime);
                    XMLResult rt_listImagesOfCrossSectionForSecondCreate = crossSectionSvc.listImagesOfCrossSection(crossectionUID_SecondTime);

                    /**************************************
                     retrun sample:
                         <trophy type="result" version="1.0">
                            <status code="%error_code%" message="%error_message%" />
                            <images_list>
                                <parameter key="first_localizer_internal_id" value="%image_uid%" />
                                <parameter key="second_localizer_internal_id" value="%image_uid%" />
                                <parameter key="slice_internal_id" value="%image_uid%" />
                                ...
                            </images_list>
                         </trophy>
                     * *************************************/

                    string first_localizer_internal_id_FirstCreate = string.Empty;
                    string second_localizer_internal_id_FirstCreate = string.Empty;
                    string first_localizer_internal_id_SecondCreate = string.Empty;
                    string second_localizer_internal_id_SecondCreate = string.Empty;

                    foreach (XMLParameterNode node in rt_listImagesOfCrossSectionForFirstCreate.MultiResults[0].Parameters)
                    {
                        switch (node.ParameterName)
                        {
                            case "first_localizer_internal_id":
                                first_localizer_internal_id_FirstCreate = node.ParameterValue;
                                break;
                            case "second_localizer_internal_id":
                                second_localizer_internal_id_FirstCreate = node.ParameterValue;
                                break;
                            default:
                                break;
                        }
                    }
                    foreach (XMLParameterNode node in rt_listImagesOfCrossSectionForSecondCreate.MultiResults[0].Parameters)
                    {
                        switch (node.ParameterName)
                        {
                            case "first_localizer_internal_id":
                                first_localizer_internal_id_SecondCreate = node.ParameterValue;
                                break;
                            case "second_localizer_internal_id":
                                second_localizer_internal_id_SecondCreate = node.ParameterValue;
                                break;
                            default:
                                break;
                        }
                    }
                    if (first_localizer_internal_id_FirstCreate == first_localizer_internal_id_SecondCreate && second_localizer_internal_id_FirstCreate == second_localizer_internal_id_SecondCreate)
                    {
                        cp_CheckListImagesOfCrossSection.Outputs.AddParameter("The localizer info in listImagesOfCrossSection is correct", "listImagesOfCrossSection", "");
                        cp_CheckListImagesOfCrossSection.Result = TestResult.Pass;
                    }
                    else
                    {
                        cp_CheckListImagesOfCrossSection.Outputs.AddParameter("The localizer info in listImagesOfCrossSection is wrong", "listImagesOfCrossSection", "");
                        cp_CheckListImagesOfCrossSection.Result = TestResult.Fail;
                    }
                    cp_CheckListImagesOfCrossSection.Outputs.AddParameter("The localizer info in listImagesOfCrossSection for the first crossSection is: ", "listImagesOfCrossSection", rt_listImagesOfCrossSectionForFirstCreate.ResultContent);
                    cp_CheckListImagesOfCrossSection.Outputs.AddParameter("The localizer info in listImagesOfCrossSection for the second crossSection is: ", "listImagesOfCrossSection", rt_listImagesOfCrossSectionForSecondCreate.ResultContent);

                    #endregion

                    #region Step 4: Call CrossSectionService.deleteCrossSection to delete the created crosssection
                    System.Collections.Generic.List<string> crossSectionUIDList = new System.Collections.Generic.List<string>();
                    crossSectionUIDList.Add(crossectionUID_FirstTime);
                    crossSectionUIDList.Add(crossectionUID_SecondTime);

                    foreach (string p_crossectionUID in crossSectionUIDList)
                    {
                        CheckPoint cp_Delete = new CheckPoint("Delete", "Step 4: Call CrossSectionService.deleteCrossSection to delete the created crosssection");
                        r.CheckPoints.Add(cp_Delete);

                        XMLResult rt_Delete = crossSectionSvc.deleteCrossSection(p_crossectionUID);

                        if (rt_Delete.IsErrorOccured)
                        {
                            cp_Delete.Result = TestResult.Fail;
                            cp_Delete.Outputs.AddParameter("Delete the created crosssection returns error", "Delete", rt_Delete.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cp_Delete.Result = TestResult.Pass;
                            cp_Delete.Outputs.AddParameter("Delete the created crosssection returns succeess. ID is: ", "Delete", p_crossectionUID);
                        }
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString());
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }

            Output();
        }
        public void Run_WorkFlow_3Dv_createCross_link_a3d_Case1686()  //  //case 1.9.3_WorkFlow_3Dv_createCross_link_a3d
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), ids.Description);

                try
                {
                    #region Parameter initialize

                    string volumeID = "";
                    //for create volume
                    XMLParameter cSeriesData = new XMLParameter("series");
                    XMLParameter cVolumeData = new XMLParameter("volume");
                    XMLParameter cSlicePathData = new XMLParameter("slices_path_list");
                    //for create study
                    XMLParameter studyPara = new XMLParameter("request");
                    XMLParameter xmlAnalysisInfo = new XMLParameter("analysis3d");
                    //for create cross section
                    XMLParameter crosssection = new XMLParameter("crosssection");
                    XMLParameter slicesPathList = new XMLParameter("slices_path_list");
                    XMLParameter slicesPSAnnotationList = new XMLParameter("slices_ps_xml_annotation_list");
                    XMLParameter slicesPSGeneralList = new XMLParameter("slices_ps_xml_general_list");
                    XMLParameter slicesPSProcessingList = new XMLParameter("slices_ps_xml_processing_list");
                    XMLParameter slicesThumbnailList = new XMLParameter("slices_ps_thumbnail_path_list");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        switch (ids.InputParameters.GetParameter(i).Step)
                        {
                            case "series":
                                cSeriesData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "volume":
                                cVolumeData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "slices_path_list":
                                cSlicePathData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "study":
                                studyPara.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "seta3d":
                                xmlAnalysisInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "create_crossSection":
                                crosssection.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "create_slices_path_list":
                                slicesPathList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "create_slices_ps_xml_annotation_list":
                                slicesPSAnnotationList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "create_slices_ps_xml_general_list":
                                slicesPSGeneralList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "create_slices_ps_xml_processing_list":
                                slicesPSProcessingList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "create_slices_ps_thumbnail_path_list":
                                slicesThumbnailList.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                        }
                    }
                    #endregion

                    #region Step 0: Create Study
                    string studyUID = string.Empty;
                    StudyService stusrv = new StudyService();
                    XMLResult stuRsl = stusrv.createStudy(studyPara);
                    if (stuRsl.IsErrorOccured)
                    {
                        continue;
                    }
                    else
                    {
                        studyUID = stuRsl.SingleResult;
                    }

                    #endregion

                    #region Step 1: Create Volume
                    CheckPoint cpCreateVolume = new CheckPoint("Create Volume Info", "Call createVolume");
                    r.CheckPoints.Add(cpCreateVolume);
                    XMLParameterCollection cInputData = new XMLParameterCollection();


                    cInputData.Add(cSeriesData);
                    cInputData.Add(cVolumeData);
                    cInputData.Add(cSlicePathData);
                    VolumeService volumesrv = new VolumeService();
                    XMLResult rslCreate = volumesrv.createVolume(studyUID, cInputData);
                    if (rslCreate.IsErrorOccured)
                    {
                        cpCreateVolume.Result = TestResult.Fail;
                        cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.Message);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        cpCreateVolume.Result = TestResult.Pass;
                        cpCreateVolume.Outputs.AddParameter("Create Volume Info", "Call createVolume", rslCreate.ResultContent);
                        volumeID = rslCreate.SingleResult;
                    }
                    #endregion

                    #region Step 2: Create Analysis3D
                    CheckPoint cpCreateA3d = new CheckPoint("Create Analysis3D", "Call createAnalysis3D");
                    r.CheckPoints.Add(cpCreateA3d);
                    Analysis3DService a3dsrv = new Analysis3DService();
                    XMLParameter a3dpara = new XMLParameter("analysis3d");
                    a3dpara.AddParameter("analysis3D_xml", "analysis3D_xml");
                    XMLResult a3dcreateRsl = a3dsrv.createAnalysis3D(volumeID, a3dpara);
                    string a3duid = "";
                    if (a3dcreateRsl.IsErrorOccured)
                    {
                        cpCreateA3d.Result = TestResult.Fail;
                        cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.Message);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        cpCreateA3d.Result = TestResult.Pass;
                        cpCreateA3d.Outputs.AddParameter("Create Analysis3D", "Call createAnalysis3D", a3dcreateRsl.ResultContent);
                        a3duid = a3dcreateRsl.SingleResult;
                    }

                    #endregion

                    #region Step 3: Create Cross Section
                    CheckPoint cpCreateCSS = new CheckPoint("Create Analysis3D", "Call createAnalysis3D");
                    r.CheckPoints.Add(cpCreateCSS);


                    XMLParameterCollection p_createCrossSection = new XMLParameterCollection();
                    p_createCrossSection.Add(crosssection);
                    p_createCrossSection.Add(slicesPathList);
                    p_createCrossSection.Add(slicesPSAnnotationList);
                    p_createCrossSection.Add(slicesPSGeneralList);
                    p_createCrossSection.Add(slicesPSProcessingList);
                    p_createCrossSection.Add(slicesThumbnailList);

                    CrossSectionService crossSectionSvc = new CrossSectionService();
                    XMLResult rt_Create = crossSectionSvc.createCrossSection(volumeID, p_createCrossSection);

                    if (rt_Create.IsErrorOccured)
                    {
                        cpCreateCSS.Result = TestResult.Fail;
                        cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns error", rt_Create.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns succeess", rt_Create.Message);

                        //Check the "internal_id" in return is present
                        bool isInternalIDCorrect = true;

                        if (rt_Create.SingleResult == null || rt_Create.SingleResult == String.Empty)
                        {
                            isInternalIDCorrect = false;
                        }

                        if (!isInternalIDCorrect)
                        {
                            cpCreateCSS.Result = TestResult.Fail;
                            cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns wrong internal_id: ", rt_Create.Message);

                            SaveRound(r);
                            break; // There is error, end test case
                        }
                        else
                        {
                            cpCreateCSS.Result = TestResult.Pass;
                            cpCreateCSS.Outputs.AddParameter("Create", "Create a new crosssection returns correct internal_id: ", rt_Create.SingleResult);

                            string crosssectionuid = rt_Create.SingleResult;

                            CheckPoint cplinkcstoa3d = new CheckPoint("link CrossSection To Analysis3D", "Call linkCrossSectionToAnalysis3D");
                            r.CheckPoints.Add(cplinkcstoa3d);

                            //link cs to a3d
                            XMLResult linkRsl = a3dsrv.linkCrossSectionToAnalysis3D(a3duid, crosssectionuid);
                            if (linkRsl.IsErrorOccured)
                            {
                                cplinkcstoa3d.Result = TestResult.Fail;
                                cplinkcstoa3d.Outputs.AddParameter("Link Fail", "Link Cross Section to Analysis3D", "Return ERROR");
                            }
                            else
                            {
                                XMLResult getcsuidfroma3d = a3dsrv.listCrossSectionsOfAnalysis3D(a3duid);
                                if (!getcsuidfroma3d.IsErrorOccured)
                                {
                                    if (crosssectionuid == getcsuidfroma3d.SingleResult)
                                    {
                                        cplinkcstoa3d.Result = TestResult.Pass;
                                        cplinkcstoa3d.Outputs.AddParameter("Link Success", "Link Cross Section to Analysis3D", "Return Cross Section is matched with link");
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Result = TestResult.Fail;
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message);
                    SaveRound(r);
                }
            }

            Output();
        }