//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(); }
//Case 1482: 1.9.3.12_getCrossSectionCompleteInfo_slices_ps_xml_processing_list public void Run_3D_GetCrossSectionCompleteInfo_SlicesPSXmlProcessingList_Case1482() { 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 crossSectionCompleteInfo_slices_ps_xml_processing_list = new XMLParameter("slices_ps_xml_processing_list"); for (int i = 0; i < ids.ExpectedValues.Count; i++) { if (ids.ExpectedValues.GetParameter(i).Step == "getCrossSectionCompleteInfo_slices_ps_xml_processing_list") { crossSectionCompleteInfo_slices_ps_xml_processing_list.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 cpCreate = new CheckPoint("Create", "Step 1: Call CrossSectionService.CreateCrossSection to create a new crosssection"); r.CheckPoints.Add(cpCreate); XMLResult rtCreate = crossSectionSvc.createCrossSection(p_volumeUID, p_createCrossSection); if (rtCreate.IsErrorOccured) { cpCreate.Result = TestResult.Fail; cpCreate.Outputs.AddParameter("Create", "Create a new crosssection returns error", rtCreate.Message); SaveRound(r); break; // There is error, end test case } else { cpCreate.Outputs.AddParameter("Create", "Create a new crosssection returns succeess", rtCreate.Message); //Check the "internal_id" in return is present bool isInternalIDCorrect = true; if (rtCreate.SingleResult == null || rtCreate.SingleResult == String.Empty) { isInternalIDCorrect = false; } if (!isInternalIDCorrect) { cpCreate.Result = TestResult.Fail; cpCreate.Outputs.AddParameter("Create", "Create a new crosssection returns wrong internal_id: ", rtCreate.Message); SaveRound(r); break; // There is error, end test case } else { cpCreate.Result = TestResult.Pass; cpCreate.Outputs.AddParameter("Create", "Create a new crosssection returns correct internal_id: ", rtCreate.SingleResult); } } #endregion #region Step 2: Call CrossSectionService.GetCrossSectionInfo to get the crosssection info CheckPoint cpGetCrossSectionCompleteInfo = new CheckPoint("GetCrossSectionInfo", "Step 2: Call CrossSectionService.GetCrossSectionCompleteInfo to get the crosssection complete info"); r.CheckPoints.Add(cpGetCrossSectionCompleteInfo); string pCrossSectionUID = rtCreate.SingleResult; XMLResult rtGetCrossSectionCompleteInfo = crossSectionSvc.getCrossSectionCompleteInfo(pCrossSectionUID); if (rtGetCrossSectionCompleteInfo.IsErrorOccured) { cpGetCrossSectionCompleteInfo.Result = TestResult.Fail; cpGetCrossSectionCompleteInfo.Outputs.AddParameter("GetCrossSectionCompleteInfo", "GetCrossSectionCompleteInfo returns error", rtGetCrossSectionCompleteInfo.Message); SaveRound(r); break; // There is error, end test case } else // Check the return value details { #region Check the value in getCrossSectionCompleteInfo return bool isValueEqual = false; bool isKeyShow = false; XMLParameter slices_ps_xml_processing_list = null; for (int i = 0; i < rtGetCrossSectionCompleteInfo.MultiResults.Count; i++) { if (rtGetCrossSectionCompleteInfo.MultiResults[i].Name == "slices_ps_xml_processing_list") { slices_ps_xml_processing_list = rtGetCrossSectionCompleteInfo.MultiResults[i]; break; } } foreach (XMLParameterNode psNode in crossSectionCompleteInfo_slices_ps_xml_processing_list.Parameters) { isValueEqual = false; isKeyShow = false; int i = 0; for (i = 0; i < slices_ps_xml_processing_list.Parameters.Count; i++) { if (psNode.ParameterName.ToLower() == slices_ps_xml_processing_list.Parameters[i].ParameterName.ToLower()) { isKeyShow = true; isValueEqual = psNode.ParameterValue.Equals(slices_ps_xml_processing_list.Parameters[i].ParameterValue); if (isValueEqual) // Here can't end current for loop to search node as there are the same Key name { break; } } } if (!isValueEqual) // There value is not matched or not found, log fail and then end the compare progress { cpGetCrossSectionCompleteInfo.Result = TestResult.Fail; if (isKeyShow) { cpGetCrossSectionCompleteInfo.Outputs.AddParameter("GetCrossSectionCompleteInfo", "Check the Cross Section info in getCrossSectionCompleteInfo return", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + slices_ps_xml_processing_list.Parameters[i].ParameterValue); } else { cpGetCrossSectionCompleteInfo.Outputs.AddParameter("GetCrossSectionCompleteInfo", "Check the Cross Section info in getCrossSectionCompleteInfo return", "The return value does not contain the node: " + psNode.ParameterName); } break; // End current foreach loop, not compare the follwing nodes } } if (isValueEqual) { cpGetCrossSectionCompleteInfo.Result = TestResult.Pass; cpGetCrossSectionCompleteInfo.Outputs.AddParameter("GetCrossSectionCompleteInfo", "Check the Cross Section info in getCrossSectionCompleteInfo return", "The return values in getCrossSectionCompleteInfo all match the expected"); } #endregion } #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(); }