//Case 62: 1.3.1_CreatePatient_Exception
        public void Run_Patient_CreatePatient_Exception_Case62()
        {
            int runCount = 0;

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

                CheckPoint pCreate = new CheckPoint("Create Patient", "Test description");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();
                XMLParameter pa = new XMLParameter("patient");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                }
                XMLResult result = ps.createPatient(pa);
                if (result.IsErrorOccured)
                {
                    pCreate.Result = TestResult.Pass;
                    pCreate.Outputs.AddParameter("That's ok to create patient error:", "Create Patient", result.Message);
                }
                else
                {
                    pCreate.Result = TestResult.Fail;
                    pCreate.Outputs.AddParameter("Expect create patient error, but it is succusss", "Create Patient", result.Message);
                }
                SaveRound(r);
            }

            Output();
        }
        //Case 47: 1.3.12_CreateAnalysis_Normal
        public void Run_Analysis_Acq_CreateAnalysis_Normal_Case47()
        {
            int runCount = 0;
            string analysisContent = "<trophy type=\"analysis\" version=\"1.0\">          <trophyheader>        <accesslog>            <creation date=\"2011-10-25\" time=\"10:54:17\" applicationname=\"kdis2dviewer\" applicationversion=\"7.0\" />            <modification date=\"2011/10/25\" time=\"10:54:18\" applicationname=\"kdis2dviewer\" applicationversion=\"7.0\" />        </accesslog>    </trophyheader>    <templateheader>        <object subtype=\"analysis\" instance=\"true\" name=\"Test Analysis\" uid=\"\" />        <comments />        <icon filepath=\"analysisicon.jpg\" />        <icon>            <ObjectData>base64imagedata</ObjectData>        </icon>        <icon id=\"thumbnailid\" />        <AnalysisProp name=\"1112222\" comments=\"\" date=\"2011-10-25\" time=\"10:54:17\" arrangementmode=\"0\" />    </templateheader>    <page index=\"0\" Dx=\"1280\" Dy=\"1024\" backgroundColour=\"RGB(0,0,0)\">        <Frame index=\"1\" type=\"floating panel\" x=\"938\" y=\"201\" w=\"200\" h=\"239\" Zorder=\"\">            <PanelProp paneltype=\"control panel xray\" id=\"control panel xray\" showstate=\"maximized\" />        </Frame>        <Frame index=\"2\" type=\"floating panel\" x=\"938\" y=\"201\" w=\"200\" h=\"240\" Zorder=\"\">            <PanelProp paneltype=\"control panel color\" id=\"control panel color\" showstate=\"maximized\" />        </Frame>        <Frame index=\"3\" type=\"image\" x=\"349\" y=\"299\" w=\"266\" h=\"355\" Zorder=\"\">            <PanelProp paneltype=\"image\" id=\"@@PSID0\" showstate=\"selected\" IdV0=\"76b3ec9d-1374-4a13-9950-6cf3f5ebc1e6\" />        </Frame>        <Frame index=\"4\" type=\"image\" x=\"818\" y=\"299\" w=\"266\" h=\"354\" Zorder=\"\">            <PanelProp paneltype=\"image\" id=\"@@PSID1\" showstate=\"deselected\" IdV0=\"eb87d761-accf-4531-b4fc-9ee9861f15fd\" />        </Frame>    </page></trophy>";

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                Round r = this.NewRound(runCount.ToString(), "Acquisition for Analysis");

                CheckPoint pAnalysis = new CheckPoint("Create Analysis", "Create Analysis");
                r.CheckPoints.Add(pAnalysis);

                XMLParameter acq = new XMLParameter("acq_info");
                string PatientID = string.Empty;
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "acquire")
                    {
                        if (ids.InputParameters.GetParameter(i).Key == "patient_internal_id")
                            PatientID = ids.InputParameters.GetParameter(i).Value;
                        acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                }
                string retPsID = string.Empty;
                string repStr = "@@PSID";
                XMLParameterCollection anaUidsXML = new XMLParameterCollection();
                XMLParameter anaUids = new XMLParameter("presentationstate");

                for (int acqTime = 0; acqTime < 2; acqTime++)
                {
                    retPsID = AcquisitionService.AcquireImage(acq);
                    if (retPsID != string.Empty)
                    {
                        analysisContent = analysisContent.Replace(repStr + acqTime, retPsID);
                        anaUids.AddParameter("internal_id", retPsID);
                    }
                }
                anaUidsXML.Add(anaUids);
                AnalysisService ass = new AnalysisService();

                XMLResult rslCreateAnalysis = ass.createAnalysis(analysisContent, false, true, PatientID, @"D:\Test\DICOM_Imag_Lib\ImportImage\thumb.PNG", anaUidsXML);

                if (rslCreateAnalysis.IsErrorOccured)
                {
                    pAnalysis.Result = TestResult.Fail;
                    pAnalysis.Outputs.AddParameter("Create Analysis", "Analysis Service", rslCreateAnalysis.Message);
                }
                else
                {
                    pAnalysis.Result = TestResult.Pass;
                    pAnalysis.Outputs.AddParameter("Create Analysis ID:", "Analysis Service", rslCreateAnalysis.SingleResult);
                }
                ass.deleteAnalysis(rslCreateAnalysis.SingleResult);
                SaveRound(r);
            }
            Output();
        }
Exemple #3
0
        public static string AcquireImage(XMLParameter acq)
        {
            string             psid      = string.Empty;
            AcquisitionService acqs      = new AcquisitionService();
            XMLResult          rslAcqRVG = acqs.startAcquisition(acq);

            System.Threading.Thread.Sleep(1000);

            if (!rslAcqRVG.IsErrorOccured)
            {
                XMLResult getAcqRVG = new XMLResult();
                do
                {
                    System.Threading.Thread.Sleep(3000);
                    getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult);
                    if (!getAcqRVG.IsErrorOccured)
                    {
                        // 2012-11-27/19006723: Change as the getAcquisitionResult return XML changes in Sprint 7

                        //int i = 0;
                        //for (i = 0; i < getAcqRVG.MultiResults[0].Parameters.Count; i++)
                        //{
                        //    if (getAcqRVG.MultiResults[0].Parameters[i].ParameterName == "presentation_state_internal_id")
                        //    {
                        //        psid = getAcqRVG.MultiResults[0].Parameters[i].ParameterValue;
                        //        break;
                        //    }
                        //}
                        //break;

                        PAS.AutoTest.TestUtility.ParseXMLContent parser = new PAS.AutoTest.TestUtility.ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML

                        string   imageID    = parser.getStringWithPathAndType("trophy/object_info", "image", "value");
                        string[] imageIDs   = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                        int      imageCount = imageIDs.Length;

                        string   psID  = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                        string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);

                        if (psIDs.Length >= 1)
                        {
                            psid = psIDs[0];
                            break;
                        }
                    }
                    if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499)
                    {
                        continue;
                    }
                    if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499)
                    {
                        break;
                    }
                } while (true);
            }
            return(psid);
        }
        public static string AcquireImage(XMLParameter acq)
        {
            string psid = string.Empty;
            AcquisitionService acqs = new AcquisitionService();
            XMLResult rslAcqRVG = acqs.startAcquisition(acq);

            System.Threading.Thread.Sleep(1000);

            if (!rslAcqRVG.IsErrorOccured)
            {
                XMLResult getAcqRVG = new XMLResult();
                do
                {
                    System.Threading.Thread.Sleep(3000);
                    getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult);
                    if (!getAcqRVG.IsErrorOccured)
                    {

                        // 2012-11-27/19006723: Change as the getAcquisitionResult return XML changes in Sprint 7

                        //int i = 0;
                        //for (i = 0; i < getAcqRVG.MultiResults[0].Parameters.Count; i++)
                        //{
                        //    if (getAcqRVG.MultiResults[0].Parameters[i].ParameterName == "presentation_state_internal_id")
                        //    {
                        //        psid = getAcqRVG.MultiResults[0].Parameters[i].ParameterValue;
                        //        break;
                        //    }
                        //}
                        //break;

                        PAS.AutoTest.TestUtility.ParseXMLContent parser = new PAS.AutoTest.TestUtility.ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML

                        string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value");
                        string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                        int imageCount = imageIDs.Length;

                        string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                        string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);

                        if (psIDs.Length >= 1)
                        {
                            psid = psIDs[0];
                            break;
                        }
                    }
                    if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499)
                        continue;
                    if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499)
                    {
                        break;
                    }
                } while (true);
            }
            return psid;
        }
        //Case 139: 1.2.1_CreatePatient_Normal
        public void Run_Patient_CreatePatient_Normal_Case139()
        {
            int runCount = 0;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Create patient");

                CheckPoint pCreate = new CheckPoint("Create Patient", "Test description");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();
                XMLParameter pa = new XMLParameter("patient");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                }
                XMLResult result = ps.createPatient(pa);
                if (result.IsErrorOccured)
                {
                    pCreate.Result = TestResult.Fail;
                    pCreate.Outputs.AddParameter("Create error:", "Create Patient", result.Message);
                }
                else
                {

                    pCreate.Outputs.AddParameter("Patient ID:", "Create Patient", result.SingleResult);

                    XMLResult getPatient = ps.getPatient(result.SingleResult);
                    if (getPatient.IsErrorOccured)
                    {
                        pCreate.Result = TestResult.Fail;
                        pCreate.Outputs.AddParameter("Get created patient fail", "Get Patient", getPatient.ResultContent);
                    }
                    else
                    {
                        pCreate.Outputs.AddParameter("Get created patient OK", "Get Patient", getPatient.ResultContent);
                        XMLResult delPatient = ps.deletePatient(result.SingleResult);
                        if (delPatient.IsErrorOccured)
                        {
                            pCreate.Result = TestResult.Fail;
                            pCreate.Outputs.AddParameter("Delete created patient fail", "Delete Patient", delPatient.ResultContent);
                        }
                        else
                        {
                            pCreate.Outputs.AddParameter("Delete created patient OK", "Delete Patient", delPatient.ResultContent);
                            pCreate.Result = TestResult.Pass;
                        }
                    }
                }
                SaveRound(r);
            }
            Output();
        }
        /// <summary>
        /// Utility_s the create patient for specific case.
        /// </summary>
        /// <param name="caseID">The case ID.</param>
        /// <returns>The patien ID</returns>
        public static string Utility_CreatePatientForSpecificCase(string caseID)
        {
            string patientUID = null;

            PatientService ps = new PatientService();
            XMLParameter pa = new XMLParameter("patient");

            pa.AddParameter("first_name", caseID);
            pa.AddParameter("last_name", caseID);
            pa.AddParameter("middle_name", caseID);

            XMLResult result = ps.createPatient(pa);

            if (!result.IsErrorOccured)
            {
                patientUID = result.SingleResult;
            }

            return patientUID;
        }
Exemple #7
0
        /// <summary>
        /// Utility_s the create patient for specific case.
        /// </summary>
        /// <param name="caseID">The case ID.</param>
        /// <returns>The patien ID</returns>
        public static string Utility_CreatePatientForSpecificCase(string caseID)
        {
            string patientUID = null;

            PatientService ps = new PatientService();
            XMLParameter   pa = new XMLParameter("patient");

            pa.AddParameter("first_name", caseID);
            pa.AddParameter("last_name", caseID);
            pa.AddParameter("middle_name", caseID);

            XMLResult result = ps.createPatient(pa);

            if (!result.IsErrorOccured)
            {
                patientUID = result.SingleResult;
            }

            return(patientUID);
        }
        public void Run()
        {
            Round r = this.NewRound("R1","Test round");

            CheckPoint p = new CheckPoint("Create Patient", "Test description");

            r.CheckPoints.Add(p);

            PatientService ps = new PatientService();

            XMLParameter pa = new XMLParameter("patient");
            pa.AddParameter(r.DataSet.InputParameters.GetParameter("dafsd").Value, "pid888");
            pa.AddParameter("dpmsid", "dpmsid888");
            pa.AddParameter("firstname", "Test");
            pa.AddParameter("lastname", "Test");
            pa.AddParameter("sex", "male");

            XMLResult result= ps.createPatient(pa);

            if (result.IsErrorOccured)
            {
                p.Result = TestResult.Fail;
                p.Outputs.AddParameter("Error", result.Message);
            }
            else
            {
                p.Result = TestResult.Pass;
                p.Outputs.AddParameter("New patient Id", result.SingleResult);
            }

            SaveRound(r);

            Output();

            System.Windows.Forms.MessageBox.Show("Done");
        }
        //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();
        }
 public XMLResult setPresentationStateInfo(XMLParameter indexInfo,string presentationStateInternalID)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setPresentationStateInfo", new object[] { indexInfo.GenerateXML(), presentationStateInternalID }));
     return this.lastResult;
 }
Exemple #11
0
 public XMLResult setVolume(string volumeUID, XMLParameter volumeCompleteInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setVolume", new object[] { volumeUID, volumeCompleteInfo.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 1089: 1.3.7_GetPresentationStateInfo_N07_Acq image and then check the DICOM info value is correct in getPSInfo return
        public void Run_PS_Acq_GetPSInfo_Case1089()
        {
            int runCount = 0;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Acquisition");
                AcquisitionService acqs = new AcquisitionService();
                PresentationStateService pss = new PresentationStateService();

                XMLParameter acq = new XMLParameter("acq_info");
                XMLParameter psa = new XMLParameter("presentationstate");

                XMLParameterCollection psaCollection = new XMLParameterCollection();

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "acquire")
                    {
                        acq.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                }

                CheckPoint pAcquire = new CheckPoint("Acquire Image", "Acquisition RVG");
                r.CheckPoints.Add(pAcquire);
                System.Diagnostics.Debug.Print("Acquire start");

                XMLResult rslAcqRVG = acqs.startAcquisition(acq);
                System.Threading.Thread.Sleep(3000);
                if (rslAcqRVG.IsErrorOccured)
                {
                    System.Diagnostics.Debug.Print("Acquire fail:");
                    pAcquire.Result = TestResult.Fail;
                    pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message);
                }
                else
                {
                    pAcquire.Outputs.AddParameter("Acquire session ID", "startAcquisition", rslAcqRVG.SingleResult);
                    int DORVGcount = 0;
                    XMLResult getAcqRVG = new XMLResult();
                    do
                    {
                        System.Threading.Thread.Sleep(3000);
                        System.Diagnostics.Debug.Print("get acquire in do");
                        DORVGcount++;
                        getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult);
                        if (!getAcqRVG.IsErrorOccured)
                        {
                            string psUid = string.Empty;

                            ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML

                            string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value");
                            string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                            int imageCount = imageIDs.Length;

                            string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                            string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                            int psCount = psIDs.Length;

                            if (imageCount == 1 && psCount == 1)
                            {
                                pAcquire.Result = TestResult.Pass;
                                pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", getAcqRVG.ResultContent);

                                psUid = psIDs[0];

                                psa.AddParameter("internal_id", psUid);
                                XMLParameter psPreferences = new XMLParameter("preferences");
                                psaCollection.Add(psa);
                                psaCollection.Add(psPreferences);

                                XMLResult psinforeturn = pss.getPresentationStateInfo(psaCollection);

                                CheckPoint pGetPSinfo = new CheckPoint("Get Presentation State", "PS Desc");
                                r.CheckPoints.Add(pGetPSinfo);
                                for (int findvalue = 0; findvalue < psinforeturn.DicomArrayResult.Length; findvalue++)
                                {
                                    XMLParameterNode psnode = psinforeturn.DicomArrayResult.Parameters[findvalue];
                                    if (psnode.ParameterName == "acquired" && psnode.ParameterValue == "true")
                                    {
                                        pGetPSinfo.Result = TestResult.Pass;
                                        pGetPSinfo.Outputs.AddParameter("get presentation state", "get presentation state info as expect", "The acquired node value is true for newly acq image");
                                        break;
                                    }
                                }
                                if (pGetPSinfo.Result != TestResult.Pass)
                                {
                                    pGetPSinfo.Result = TestResult.Fail;
                                    pGetPSinfo.Outputs.AddParameter("get presentation state", "get presentation state info not as expect", "The acquired node value is NOT true for newly acq image. Actually get: " + psinforeturn.ResultContent);
                                }
                            }
                            else
                            {
                                pAcquire.Result = TestResult.Fail;
                                pAcquire.Outputs.AddParameter("getAcquisitionResult", "Acquisition", "Wrong return XML: " + getAcqRVG.ResultContent);
                            }

                            break; // The test case is finished, end the "do" loop
                        }
                        if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499)
                            continue;
                        if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499)
                        {
                            pAcquire.Result = TestResult.Fail;
                            pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", getAcqRVG.Message);
                        }
                        System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount);
                        if (DORVGcount > 60)
                        {
                            pAcquire.Result = TestResult.Fail;
                            pAcquire.Outputs.AddParameter("Get acquire image error", "getAcquisitionResult", "Acquire great with 3 minutes, timeout!");
                            break;
                        }
                    } while (true);
                }
                SaveRound(r);
            }
            Output();
        }
        public override void Run()
        {
            string openObjInfo = string.Empty;
            string psId = string.Empty;
            KDIS7ImageWindow iw = new KDIS7ImageWindow();
            KDIS7ATAssistant ka = new KDIS7ATAssistant();

            ApplicationService appService = new ApplicationService();

            try
            {
                string PatientId = CommonLib.CreatePatient();
                ImportService import = new ImportService();
                XMLResult importResult = import.importObject(PatientId, string.Empty, @"c:\PASPerformance\001.png",null, true, string.Empty);
                psId = importResult.MultiResults[1].GetParameterValueByIndex(0);

                XMLParameter pa = new XMLParameter("two_dimension_viewer");
                pa.AddParameter("internal_id", psId);

                openObjInfo = pa.GenerateXML();

                appService.openObjects(pa);
                iw.ItemByID(psId).WaitProperty("ShownOnScreen", true, 60);
            }
            catch (Exception ex)
            {
                LogRecordType lr = new LogRecordType();
                lr.FunctionName = this.mFunctionName;
                lr.Lable = this.mLabel;
                string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                lr.Passed = false;

                Log.AddRecord(lr);

                this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true);
                this.RiseTestCaseCompleteEvent();

                this.mExecuted = this.mRepeat;
                this.mFailed = this.mRepeat;

                return;
            }

            for (int i = 1; i <= this.mRepeat; i++)
            {
                LogRecordType lr = new LogRecordType();
                lr.Lable = this.mLabel;
                lr.FunctionName = this.mFunctionName;

                try
                {
                    XMLResult result = new XMLResult(appService.InvokeMethod("openObjects", new object[] { openObjInfo }));

                    lr.ResponseTime = appService.ResponseTime;
                    lr.Passed = !(result.IsErrorOccured);

                    if (!lr.Passed)
                    {
                        lr.Message = result.Message;
                        this.mFailed++;
                    }
                    else
                    {
                        lr.Message = result.SingleResult;
                        this.mExectuedTime += lr.ResponseTime;
                    }
                }
                catch (Exception ex)
                {
                    this.mFailed++;
                    lr.Passed = false;
                    string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                    lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                }

                this.mExecuted = i;
                Log.AddRecord(lr);

                this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed);
            }

            this.RiseTestCaseCompleteEvent();
        }
 public XMLResult setStudy(string studyInternalID, XMLParameter studyInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setStudy", new object[] { studyInternalID, studyInfo.GenerateXML() }));
     return(this.lastResult);
 }
        //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();

            }
        }
Exemple #16
0
 public XMLResult queryDevices(XMLParameter sensorTypeList)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("queryDevices", new object[] { sensorTypeList.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #17
0
 public XMLResult queryLines(XMLParameter deviceIdList)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("queryLines", new object[] { deviceIdList.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #18
0
 public XMLResult startAcquisition(XMLParameter acqInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("startAcquisition", new object[] { acqInfo.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #19
0
        public static string AcquireFMS(XMLParameter acq)
        {
            string             rt_fmsID = string.Empty;
            AcquisitionService acqs     = new AcquisitionService();

            XMLResult rslAcqRVG = acqs.startAcquisition(acq);

            System.Threading.Thread.Sleep(3000);
            Utility.AcqFMS(40, 300);

            int       DORVGcount = 0;
            XMLResult getAcqRVG  = new XMLResult();

            do
            {
                System.Threading.Thread.Sleep(3000);
                System.Diagnostics.Debug.Print("get acquire in do");
                DORVGcount++;
                getAcqRVG = acqs.getAcquisitionResult(rslAcqRVG.SingleResult);
                if (!getAcqRVG.IsErrorOccured)
                {
                    ParseXMLContent parser = new ParseXMLContent(getAcqRVG.ResultContent); // To parse the return XML

                    string   fmsID    = parser.getStringWithPathAndType("trophy/object_info", "fms", "value");
                    string[] fmsIDs   = fmsID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int      fmsCount = fmsIDs.Length;

                    string   imageID    = parser.getStringWithPathAndType("trophy/object_info", "image", "value");
                    string[] imageIDs   = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int      imageCount = imageIDs.Length;

                    string   psID    = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                    string[] psIDs   = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int      psCount = psIDs.Length;

                    if (fmsCount == 1 && imageCount >= 1 && psCount >= 1 && imageCount == psCount)
                    {
                        rt_fmsID = fmsIDs[0];
                    }
                    else
                    {
                        rt_fmsID = "";
                    }
                    break;
                }
                if (getAcqRVG.IsErrorOccured && getAcqRVG.Code != 499)
                {
                    continue;
                }
                if (getAcqRVG.Code != 0 && getAcqRVG.Code != 499)
                {
                    rt_fmsID = string.Empty;
                }
                System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount);
                if (DORVGcount > 60)
                {
                    rt_fmsID = string.Empty;
                    break;
                }
            } while (true);

            return(rt_fmsID);
        }
Exemple #20
0
 public XMLResult setAnalysisInfo(string analysisInternalID, XMLParameter indexedInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setAnalysisInfo", new object[] { analysisInternalID, indexedInfo.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #21
0
 public XMLResult setImageInfo(XMLParameter imageInfo, string imageInternalID)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setImageInfo", new object[] { imageInfo.GenerateXML(), imageInternalID }));
     return(this.lastResult);
 }
        //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 1364: 1.9.1_WorkFlow_CreateVolume_GetVolumeInfo_customdata
        public void Run_3D_CreateVolume_GetVolumeInfo_Customdata_Case1364()
        {
            int runCount = 0;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "WorkFlow CreateVolume_GetVolume_CustomData");

                try
                {
                    VolumeService vs = new VolumeService();
                    string volumeID = null;
                    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;

                        }
                    }

                    string ep_3dscanmode = null;
                    string ep_3dscanobject = null;
                    string ep_3dfunctionalmode = null;

                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "get")
                        {
                            switch (ids.ExpectedValues.GetParameter(i).Key)
                            {
                                case "3dscanmode":
                                    ep_3dscanmode = ids.ExpectedValues.GetParameter(i).Value;
                                    break;
                                case "3dscanobject":
                                    ep_3dscanobject = ids.ExpectedValues.GetParameter(i).Value;
                                    break;
                                case "3dfunctionalmode":
                                    ep_3dfunctionalmode = ids.ExpectedValues.GetParameter(i).Value;
                                    break;
                                default:
                                    break;
                            }
                        }
                    }

                    CheckPoint pCreate = new CheckPoint("Create", "WorkFlow CreateVolume_GetVolume_CustomData");
                    r.CheckPoints.Add(pCreate);

                    cInputData.Add(cSeriesData);
                    cInputData.Add(cVolumeData);
                    cInputData.Add(cSlicePathData);
                    XMLResult rslCreate = vs.createVolume(studyUID, cInputData);

                    if (!rslCreate.IsErrorOccured)
                    {
                        pCreate.Result = TestResult.Pass;
                        volumeID = rslCreate.SingleResult;
                        pCreate.Outputs.AddParameter("Create", "CreateVolume_GetVolume_CustomData Success", volumeID);
                    }
                    else
                    {
                        pCreate.Result = TestResult.Fail;
                        pCreate.Outputs.AddParameter("Create", "CreateVolume_GetVolume_CustomData Fail", rslCreate.ResultContent);
                        SaveRound(r);
                        continue;
                    }

                    CheckPoint pGet = new CheckPoint("Get", "WorkFlow CreateVolume_GetVolume_CustomData");
                    r.CheckPoints.Add(pGet);

                    XMLParameter filter = new XMLParameter("volume");
                    filter.AddParameter("internal_id", volumeID);
                    filter.AddParameter("path_type", "all");

                    string str1 = string.Empty;
                    string str2 = string.Empty;
                    string str3 = string.Empty;
                    XMLResult rslget = vs.getVolumeInfo(filter);
                    foreach (XMLParameter p in rslget.MultiResults)
                    {
                        if (p.Name == "volume")
                        {
                            str1 = p.GetParameterValue("3dscanmode");
                            str2 = p.GetParameterValue("3dscanobject");
                            str3 = p.GetParameterValue("3dfunctionalmode");
                        }
                    }

                    if (!rslget.IsErrorOccured && str1 == ep_3dscanmode && str2 == ep_3dscanobject && str3 == ep_3dfunctionalmode)
                    {
                        pGet.Result = TestResult.Pass;
                        pGet.Outputs.AddParameter("Get", "CreateVolume_GetVolume_CustomData Success", rslget.ResultContent);
                        vs.deleteVolume(volumeID);
                    }
                    else
                    {
                        pGet.Result = TestResult.Fail;
                        pGet.Outputs.AddParameter("Get", "CreateVolume_GetVolume_CustomData Fail", rslget.ResultContent);
                    }

                    vs.deleteVolume(volumeID);

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

            Output();
        }
Exemple #24
0
 public XMLResult setAsynAcqPatientInfo(XMLParameter asyncAcqPatientInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setAsynAcqPatientInfo", new object[] { asyncAcqPatientInfo.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 38: 1.3.1_DeletePatient_Normal
        public void Run_Patient_DeletePatient_Normal_Case38()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            bool isCreatePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "delete patient");
                CheckPoint pCreate = new CheckPoint("Create Patient", "Test create");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();

                XMLParameter cpatientData = new XMLParameter("patient");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        cpatientData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                }
                if (isCreatePatient)
                {
                    XMLResult rslCreate = ps.createPatient(cpatientData);
                    if (!rslCreate.IsErrorOccured)
                    {
                        patientUID = rslCreate.SingleResult;
                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                        XMLResult rslGet = ps.getPatient(patientUID);
                        if (!rslGet.IsErrorOccured && rslGet.Code == 0)
                        {
                            CheckPoint pDel = new CheckPoint("Delete Patient", "Test delete");
                            r.CheckPoints.Add(pDel);
                            XMLResult rslDel = ps.deletePatient(patientUID);
                            System.Threading.Thread.Sleep(2000);

                            if (!rslDel.IsErrorOccured)
                            {
                                rslGet = ps.getPatient(patientUID);
                                if (rslGet.IsErrorOccured && rslGet.Code == 1020)
                                {
                                    pDel.Outputs.AddParameter("Delete", "Delete patient success", patientUID);
                                    pDel.Outputs.AddParameter("Get", "Get patient ERR", rslGet.Message);
                                    pDel.Result = TestResult.Pass;
                                }
                            }
                            else
                            {
                                pDel.Result = TestResult.Fail;
                            }
                        }

                    }
                    else
                    {
                        pCreate.Result = TestResult.Fail;
                        pCreate.Outputs.AddParameter("create", "Create patient ERR", rslCreate.Message);
                    }
                }

                SaveRound(r);
            }
            Output();
        }
Exemple #26
0
 public XMLResult deleteImage(string imageInternalID, XMLParameter preferences)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("deleteImage", new object[] { imageInternalID, preferences.GenerateXML() }));
     return(this.lastResult);
 }
        // Case 1654: 1.3.1_QueryPatients_N6_grouped by keyword in global search
        public void Run_Patient_QueryPatient_Case1654()
        {
            int runCount = 0;
            List<string> needDelete = new List<string>();

            // step 1. create listed patients.
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                bool bSkip = false; // to skip query InputDataSet
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "queryPatient")
                        bSkip = true;
                }
                if (bSkip)
                    continue;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Create patient");

                CheckPoint pCreate = new CheckPoint("Create Patient", "Test description");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();
                XMLParameter pa = new XMLParameter("patient");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "createPatient")
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                }
                XMLResult result = ps.createPatient(pa);
                if (result.IsErrorOccured)
                {
                    pCreate.Result = TestResult.Fail;
                    pCreate.Outputs.AddParameter("Create error:", "Create Patient", result.Message);
                }
                else
                {
                    pCreate.Result = TestResult.Pass;
                    pCreate.Outputs.AddParameter("Patient ID:", "Create Patient", result.SingleResult);
                    needDelete.Add(result.SingleResult);
                }
                SaveRound(r);
            }
            // step 2. query.
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                bool bSkip = false; // to skip create patient InputDataSet
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "createPatient")
                        bSkip = true;
                }
                if (bSkip)
                    continue;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Query patient");

                CheckPoint pQuery = new CheckPoint("Query Patient", "Test description");
                r.CheckPoints.Add(pQuery);
                PatientService ps = new PatientService();
                XMLParameter query = new XMLParameter("filter");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "queryPatient")
                        query.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                }

                XMLResult queryPatient = ps.queryPatients(query); // should send global_search
                if (queryPatient.IsErrorOccured)
                {
                    pQuery.Result = TestResult.Fail;
                    pQuery.Outputs.AddParameter("Query created patient fail", "Query Patient", queryPatient.ResultContent);
                }
                else
                {
                    pQuery.Outputs.AddParameter("Query created patient OK", "Query Patient", queryPatient.ResultContent);
                    // Here should add the checker for XMLResult
                    //
                    int iTotalExpectedResult = 0;
                    foreach (Parameter p in ids.ExpectedValues.Parameters)
                    {
                        int iStep = 0;
                        if (System.Int32.TryParse(p.Step, out iStep))
                        {
                            iTotalExpectedResult = iStep > iTotalExpectedResult ? iStep : iTotalExpectedResult;
                        }
                    }

                    System.Xml.XmlDocument xmlResult = new System.Xml.XmlDocument();
                    xmlResult.LoadXml(queryPatient.ResultContent);
                    int iNodelist = 0;
                    System.Xml.XmlNodeList patientList = xmlResult.SelectNodes("trophy/patient");
                    foreach (System.Xml.XmlNode patient in patientList)
                    {
                        if (iNodelist < iTotalExpectedResult)
                        {
                            // find the pAttr Key, should check whether the key attribute value is in expected result.
                            foreach (Parameter pExpected in ids.ExpectedValues.Parameters)
                            {
                                int iStep = 0;
                                if (System.Int32.TryParse(pExpected.Step, out iStep))
                                {
                                    if (iStep == (iNodelist + 1))
                                    {
                                        bool bChecked = false;
                                        // if iNodelist is less than expected value, should check whether this is the expected value ordered by global_search
                                        System.Xml.XmlNodeList parameterList = patient.SelectNodes("parameter");
                                        foreach (System.Xml.XmlNode parameter in parameterList)
                                        {
                                            if (parameter.Attributes["key"].Value == pExpected.Key)
                                            {
                                                if (parameter.Attributes["value"].Value == pExpected.Value)
                                                {
                                                    string step = "row (" + iStep + ")" + "key (" + pExpected.Key + ") check successful";
                                                    string key = "query patient";
                                                    string value = "value (" + pExpected.Value + ")";
                                                    pQuery.Outputs.AddParameter(step, key, value);
                                                    pQuery.Result = TestResult.Pass;
                                                    bChecked = true;
                                                }
                                                else
                                                {
                                                    string step = "row (" + iStep + ")" + "key (" + pExpected.Key + ") check fail";
                                                    string key = "query patient";
                                                    string value = "value (" + pExpected.Value + ")";
                                                    pQuery.Outputs.AddParameter(step, key, value);
                                                    pQuery.Result = TestResult.Fail;
                                                    bChecked = true;
                                                }
                                                break; // find the expected key value
                                            }
                                        }
                                        if (!bChecked) // the expected value is not find in expected row
                                        {
                                            string step = "row (" + iStep + ")" + "key (" + pExpected.Key + ") check missed";
                                            string key = "query patient";
                                            string value = "value (" + pExpected.Value + ")";
                                            pQuery.Outputs.AddParameter(step, key, value);
                                            pQuery.Result = TestResult.Fail;
                                            bChecked = true;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            // here , iNodelist is greater than expected value, so this record is more than expected.
                            string step = "row (" + (iNodelist + 1) + ") is not expected";
                            string key = "query patient";
                            string value = patient.InnerXml;
                            pQuery.Outputs.AddParameter(step, key, value);
                            pQuery.Result = TestResult.Fail;
                        }
                        iNodelist++;
                    }
                    if (patientList.Count == 0)
                    {
                        string step = "no any query results";
                        string key = "query patient";
                        string value = queryPatient.ResultContent;
                        pQuery.Outputs.AddParameter(step, key, value);
                        pQuery.Result = TestResult.Fail;
                    }
                }
                SaveRound(r);
            }
            // step 3. delete listed patients.
            foreach (string delpa in needDelete)
            {
                PatientService ps = new PatientService();
                XMLParameter query = new XMLParameter("patient");
                XMLResult delPatient = ps.deletePatient(delpa);
                if (delPatient.IsErrorOccured)
                {
                    Round r = this.NewRound(runCount.ToString(), "Delete patient");
                    CheckPoint pDelete = new CheckPoint("Delete Patient", "Test description");
                    r.CheckPoints.Add(pDelete);
                    pDelete.Result = TestResult.Fail;
                    pDelete.Outputs.AddParameter("Delete created patient fail", "Delete Patient", delPatient.ResultContent);
                    SaveRound(r);
                }
            }

            Output();
        }
 public XMLResult listInstances(XMLParameter listInfomation)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("listInstances", new object[] { listInfomation.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 1091: 1.3.7_WorkFlow_AcquireRVG+SetImageInfo+GetPresentationStateInfo_RadioLogInformation
        public void Run_PS_Acq_Radiolog_Case1091()
        {
            //int runCount = this.Input.Repetition;

            int runCount = 0; // this is the initial run count. Use this count to repeat different test data set.

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

                //Mark the check point here to indicate what's the check point here
                CheckPoint p1 = new CheckPoint("createPatient", "Setup environment of createPatient");
                CheckPoint p2 = new CheckPoint("startAcquisition", "Setup environment of acquisition");
                CheckPoint p3 = new CheckPoint("getAcquisitionResult", "Setup environment of image and PS id");
                CheckPoint p4 = new CheckPoint("setImageInfo", "Setup environment of setImageInfo");
                CheckPoint p5 = new CheckPoint("getImageInfo", "Test getImageInfo");
                CheckPoint p6 = new CheckPoint("getPresentationStateInfo", "Test getPresentationStateInfo");

                r.CheckPoints.Add(p1);
                r.CheckPoints.Add(p2);
                r.CheckPoints.Add(p3);
                r.CheckPoints.Add(p4);
                r.CheckPoints.Add(p5);
                r.CheckPoints.Add(p6);

                //create required PAS service instaces here
                PatientService pats = new PatientService();
                AcquisitionService acq = new AcquisitionService();
                ImageService img = new ImageService();
                PresentationStateService ps = new PresentationStateService();

                //create input parameters here, it may include XML path type and string type value
                XMLParameter pa1 = new XMLParameter("patient");
                XMLParameter pa2 = new XMLParameter("acq_info");
                XMLParameter pa3 = new XMLParameter("getAcquisitionResult");
                XMLParameter pa4 = new XMLParameter("image");
                XMLParameter pa5 = new XMLParameter("image");
                XMLParameter pt6 = new XMLParameter("presentationstate");
                XMLParameterCollection pa6 = new XMLParameterCollection();

                try
                {

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        switch (ids.InputParameters.GetParameter(i).Step)
                        {
                            case "createPatient":
                                pa1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "acquire":
                                pa2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "setImageInfo":
                                pa4.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            default:
                                Console.WriteLine("There is no valid selection when parse input parameters.");
                                break;
                        }
                    }

                    //If we need change parameter by specific logic, please put code here

                    //Get service result
                    //Step1 result

                    XMLResult step1_result = pats.createPatient(pa1);

                    //Log step1 service output
                    if (step1_result.IsErrorOccured)
                    {
                        p1.Result = TestResult.Fail;
                        p1.Outputs.AddParameter("createPatient", "Error", step1_result.ResultContent);
                        SaveRound(r);
                        continue;
                    }

                    p1.Result = TestResult.Pass;
                    p1.Outputs.AddParameter("createPatient", "Success", step1_result.ResultContent);

                    //Change input parameter according the output of Step1
                    pa2.AddParameter("patient_internal_id", step1_result.SingleResult);

                    //Step2 result

                    //if acquireType isn't emtpy string, skip step2, here is only RVG acquisition
                    bool acqflag = true;
                    XMLResult step3_result = new XMLResult();
                    if (pa2.GetParameterValueByName("acquireType") == null || pa2.GetParameterValueByName("acquireType") == "")
                    {
                        XMLResult rslAcqRVG = acq.startAcquisition(pa2);
                        System.Threading.Thread.Sleep(3000);
                        if (rslAcqRVG.IsErrorOccured)
                        {
                            System.Diagnostics.Debug.Print("Acquire fail:");
                            p2.Result = TestResult.Fail;
                            p2.Outputs.AddParameter("acquire", "Acquire image error", rslAcqRVG.Message);
                        }
                        else
                        {
                            p2.Result = TestResult.Pass;
                            p2.Outputs.AddParameter("acquire", "Acquire session ID", rslAcqRVG.SingleResult);
                            int DORVGcount = 0;
                            do
                            {
                                System.Threading.Thread.Sleep(3000);
                                System.Diagnostics.Debug.Print("get acquire in do");
                                DORVGcount++;
                                step3_result = acq.getAcquisitionResult(rslAcqRVG.SingleResult);
                                if (!step3_result.IsErrorOccured)
                                {
                                    // move this to out of do-while loop as need check the return value is correct or not there
                                    //p3.Result = TestResult.Pass;
                                    //p3.Outputs.AddParameter("acquire", "Get acquire image", step3_result.Message);
                                    acqflag = false;
                                    break;
                                }
                                if (step3_result.Code != 501)
                                {
                                    continue;
                                }
                                else
                                {
                                    p3.Result = TestResult.Fail;
                                    p3.Outputs.AddParameter("acquire", "Get acquire image error", step3_result.Message);
                                    acqflag = false;
                                }
                                System.Diagnostics.Debug.Print("get acquireResult:" + DORVGcount);
                                if (DORVGcount > 60)
                                {
                                    p3.Result = TestResult.Fail;
                                    p3.Outputs.AddParameter("acquire", "Get acquire image error", "Acquire greate with 3 minutes, timeout!");
                                    acqflag = false;
                                    break;
                                }
                            } while (acqflag);
                        }
                    }

                    //Change input parameter according the output of Step3
                    // if step3 is skipped, step4,step5,setp6 input has no need parameter of internal_id

                    //2012-11-28/19006723: Chanege as ther getAcquisitionResult result change, need new way to get the image ID and PS ID
                    string imgInternalID = string.Empty;
                    string psInternalID = string.Empty;

                    ParseXMLContent parser = new ParseXMLContent(step3_result.ResultContent); // To parse the return XML

                    string imageID = parser.getStringWithPathAndType("trophy/object_info", "image", "value");
                    string[] imageIDs = imageID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int imageCount = imageIDs.Length;

                    string psID = parser.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                    string[] psIDs = psID.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    int psCount = psIDs.Length;

                    if (imageCount == 1 && psCount == 1)
                    {
                        p3.Result = TestResult.Pass;
                        p3.Outputs.AddParameter("acquire", "getAcquisitionResult return OK", step3_result.ResultContent);

                        imgInternalID = imageIDs[0];
                        psInternalID = psIDs[0];

                        pa5.AddParameter("internal_id", imgInternalID);
                        pt6.AddParameter("internal_id", psInternalID);
                    }
                    else
                    {
                        p3.Result = TestResult.Fail;
                        p3.Outputs.AddParameter("acquire", "getAcquisitionResult return ERROR", step3_result.ResultContent);
                        SaveRound(r);
                        continue; // Not run below steps
                    }

                    //if (step3_result.MultiResults.Count > 0)
                    //{
                    //    for (int j = 0; j < step3_result.MultiResults.Count; j++)
                    //    {
                    //        for (int i = 0; i < step3_result.MultiResults[j].Parameters.Count; i++)
                    //        {
                    //            if (step3_result.MultiResults[j].Parameters[i].ParameterName == "image_internal_id")
                    //            {
                    //                imgInternalID = step3_result.MultiResults[j].Parameters[i].ParameterValue;
                    //                pa5.AddParameter("internal_id", step3_result.MultiResults[j].Parameters[i].ParameterValue);
                    //            }
                    //            if (step3_result.MultiResults[j].Parameters[i].ParameterName == "presentation_state_internal_id")
                    //            {
                    //                pt6.AddParameter("internal_id", step3_result.MultiResults[j].Parameters[i].ParameterValue);
                    //            }
                    //        }
                    //    }
                    //}

                    //Step4 result
                    XMLResult step4_result = img.setImageInfo(pa4, imgInternalID);

                    //Log step4 service output
                    if (step4_result.IsErrorOccured)
                    {
                        p4.Result = TestResult.Fail;
                        p4.Outputs.AddParameter("setImageInfo", "Error", step4_result.ResultContent);
                        SaveRound(r);
                        continue;
                    }

                    p4.Result = TestResult.Pass;
                    p4.Outputs.AddParameter("setImageInfo", "Success", step4_result.ResultContent);

                    //Step5 result
                    XMLResult step5_result = img.getImageInfo(pa5);

                    //Log step3 service output
                    //Compare the Expected parameters of getImageInfo and output result of getImageInfo
                    //count of compare matched parameters
                    int compCount = 0;
                    //count of expected parameters on getImageInfo
                    int expectedParameterCount = 0;
                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getImageInfo")
                        {
                            expectedParameterCount++;
                        }
                    }

                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getImageInfo" && ids.ExpectedValues.Parameters[index].Value == step5_result.DicomArrayResult.GetParameterValueByName(ids.ExpectedValues.Parameters[index].Key))
                        {
                            compCount++;
                        }
                    }

                    if (step5_result.IsErrorOccured || compCount != expectedParameterCount)
                    {
                        p5.Result = TestResult.Fail;
                        p5.Outputs.AddParameter("getImageInfo", "Error", step5_result.ResultContent);
                        SaveRound(r);
                        continue;
                    }

                    p5.Result = TestResult.Pass;
                    p5.Outputs.AddParameter("getImageInfo", "Success", step5_result.ResultContent);

                    //Change input parameter according the output of Step6

                    //generate input parameter collection of step6
                    pa6.Add(pt6);
                    //Step6 result

                    XMLResult step6_result = ps.getPresentationStateInfo(pa6);

                    //Log step6 service output
                    //Compare the Expected parameters of getPresentationStateInfo and output result of getPresentationStateInfo
                    compCount = 0;
                    //count of expected parameters on getPresentationStateInfo
                    expectedParameterCount = 0;
                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getPresentationStateInfo")
                        { expectedParameterCount++; }
                    }

                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getPresentationStateInfo" && ids.ExpectedValues.Parameters[index].Value == step6_result.DicomArrayResult.GetParameterValueByName(ids.ExpectedValues.Parameters[index].Key))
                        { compCount++; }
                    }

                    if (step6_result.IsErrorOccured || compCount != expectedParameterCount)
                    {
                        p6.Result = TestResult.Fail;
                        p6.Outputs.AddParameter("getPresentationStateInfo", "Error", step6_result.ResultContent);
                    }
                    else
                    {
                        p6.Result = TestResult.Pass;
                        p6.Outputs.AddParameter("getPresentationStateInfo", "Success", step6_result.ResultContent);
                    }

                    //Save data for each round
                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint p = new CheckPoint("Excepption", "Exception thrown when case run: "+ex.ToString());
                    r.CheckPoints.Add(p);
                    SaveRound(r);
                }
            }

            //Save service log as xml file
            Output();
        }
Exemple #30
0
 public XMLResult createApplication(string application, XMLParameter config)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("createApplication", new object[] { application, config.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #31
0
 public XMLResult getImageInfo(XMLParameter imageInternalID)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("getImageInfo", new object[] { imageInternalID.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #32
0
 public XMLResult setConfiguration(string appliInstanceID, XMLParameter config)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setConfiguration", new object[] { appliInstanceID, config.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #33
0
 public XMLResult openObjects(XMLParameter objectInternalIDs)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("openObjects", new object[] { objectInternalIDs.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #34
0
 public XMLResult createImage(XMLParameter imageInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("createImage", new object[] { imageInfo.GenerateXML() }));
     return(this.lastResult);
 }
        public override void Run()
        {
            string newPSId = string.Empty;
            string setPSInfoString = string.Empty;
            string getPSInfoString = string.Empty;
            PresentationStateService psService = new PresentationStateService();

            try
            {
                //create a new patient and import a new image to get a new ps id.
                string newPatientId = CommonLib.CreatePatient();
                ImportService import = new ImportService();
                XMLResult r = import.importObject(newPatientId, string.Empty, @"c:\PASPerformance\001.png", null, true, string.Empty);
                newPSId = r.MultiResults[1].GetParameterValueByIndex(0);
                XMLParameter psId = new XMLParameter("presentationstate");
                psId.AddParameter("internal_id", newPSId);
                getPSInfoString = psId.GenerateXML();
                XMLParameterCollection c = new XMLParameterCollection();
                c.Add(psId);
                setPSInfoString = psService.getPresentationStateInfo(c).ArrayResult.GenerateXML();
            }
            catch (Exception ex)
            {
                LogRecordType lr = new LogRecordType();
                lr.FunctionName = this.mFunctionName;
                lr.Lable = this.mLabel;
                string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                lr.Passed = false;

                Log.AddRecord(lr);

                this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed, true);
                this.RiseTestCaseCompleteEvent();

                this.mExecuted = this.mRepeat;
                this.mFailed = this.mRepeat;
                return;
            }

            double userCaseResponse=0;

            for (int i = 1; i <= this.mRepeat; i++)
            {
                LogRecordType lr = new LogRecordType();
                lr.Lable = this.mLabel;
                lr.FunctionName = this.mFunctionName;

                try
                {
                    //get ps info
                    XMLResult getResult=new XMLResult (psService.InvokeMethod ("getPresentationStateInfo", new object []{getPSInfoString }));

                    //if get presentation infor failed.
                    if (getResult.IsErrorOccured)
                    {
                        lr.Message = "Get PS info faild. Message: " + getResult.Message;
                        lr.ResponseTime = psService.ResponseTime;
                        lr.Passed = false;
                        Log.AddRecord(lr);
                        this.mFailed++;
                        continue;
                    }
                    else  //if get ps info successed
                    {
                        userCaseResponse = psService.ResponseTime;
                    }

                    //set ps info
                    XMLResult setResult = new XMLResult(psService.InvokeMethod("setPresentationStateInfo", new object[] { setPSInfoString, newPSId}));

                    //if set ps info failed
                    if (setResult.IsErrorOccured)
                    {
                        lr.Message = "Set PS info failed. Message: " + setResult.Message;
                        lr.ResponseTime = psService.ResponseTime;
                        lr.Passed = false;
                        Log.AddRecord(lr);
                        this.mFailed++;
                        continue;
                    }
                    else  //if set ps info successed.
                    {
                        userCaseResponse += psService.ResponseTime;
                    }

                    lr.ResponseTime = userCaseResponse;
                    this.ExecutedTime += userCaseResponse;
                }
                catch (Exception ex)
                {
                    this.mFailed++;
                    lr.Passed = false;
                    string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                    lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                }

                this.mExecuted = i;
                Log.AddRecord(lr);

                this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed);
            }

            this.RiseTestCaseCompleteEvent();
        }
Exemple #36
0
 public XMLResult uploadFile(XMLParameter fileURL)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("uploadFile", new object[] { fileURL.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 1220: 1.9.1_WorkFlow_N2_Import CS Model_GetVolumeInfo
        public void Run_3D_ImportCSModel_GetVolumeInfo_Case1220()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            bool isCreatePatient = false;
            bool isDeletePatient = true;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Import image");

                ImportService importSvc = new ImportService();
                XMLParameter pCreatePatient = new XMLParameter("patient");
                XMLParameter pImportImage = new XMLParameter("import");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        pCreatePatient.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "import")
                    {
                        pImportImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                }

                XMLParameter epGetVolumeInfo = new XMLParameter();

                for (int i = 0; i < ids.ExpectedValues.Count; i++)
                {
                    if (ids.ExpectedValues.GetParameter(i).Step == "getVolumeInfo")
                    {
                        epGetVolumeInfo.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                    }
                }

                try
                {
                    PatientService patientSvc = new PatientService();
                    if (isCreatePatient)
                    {
                        CheckPoint pCreate = new CheckPoint("Create Patient", "Test create");
                        r.CheckPoints.Add(pCreate);

                        XMLResult result = patientSvc.createPatient(pCreatePatient);
                        if (!result.IsErrorOccured)
                        {
                            patientUID = result.SingleResult;
                            pCreate.Result = TestResult.Pass;
                            pCreate.Outputs.AddParameter("Create patient UID", "Create Patient", patientUID);
                        }
                        else
                        {
                            pCreate.Result = TestResult.Fail;
                            pCreate.Outputs.AddParameter("Create patient returns error", "Create Patient", result.ResultContent);
                        }
                    }

                    CheckPoint cpImport = new CheckPoint("Import Image", "Test import");
                    r.CheckPoints.Add(cpImport);

                    string filePath = string.Empty;
                    string archivePath = string.Empty;
                    bool overrideExisted = false;
                    for (int c = 0; c < pImportImage.Length; c++)
                    {
                        if (pImportImage.GetParameterName(c) == "path")
                            filePath = pImportImage.GetParameterValue(c);
                        if (pImportImage.GetParameterName(c) == "archivePath")
                            archivePath = pImportImage.GetParameterValue(c);
                        if (pImportImage.GetParameterName(c) == "move")
                        {
                            if (pImportImage.GetParameterValue(c) == "true")
                                overrideExisted = true;
                        }
                    }

                    XMLResult rtlImport = importSvc.importObject(patientUID, "", filePath, archivePath, overrideExisted, "false");

                    /**********************************************
                        import return sample:
                        - <trophy type="result" version="1.0">
                          <status code="0" message="ok" />
                        - <volume>
                          <parameter key="internal_id" value="5412d81a-c096-4b0d-ab93-524266af21b6" />
                          </volume>
                          </trophy>
                     * **********************************************/

                    if (rtlImport.IsErrorOccured)
                    {
                        cpImport.Result = TestResult.Fail;
                        cpImport.Outputs.AddParameter("Import volume fail", "Import", rtlImport.Message);
                        cpImport.Outputs.AddParameter("Import volume returns error code", "Import", rtlImport.Code.ToString());
                    }
                    else
                    {
                        // Check the return contiains image id and ps id
                        string volumeID = null;
                        volumeID = rtlImport.MultiResults[0].GetParameterValueByName("internal_id"); // image internal_id
                        if (volumeID == null || volumeID == string.Empty)
                        {
                            cpImport.Result = TestResult.Fail;
                            cpImport.Outputs.AddParameter("Import volume returns wrong volume internal id", "Import", rtlImport.ResultContent);
                        }
                        else
                        {
                            cpImport.Result = TestResult.Pass;
                            cpImport.Outputs.AddParameter("import volume returns OK", "Import", rtlImport.ResultContent);
                        }

                        #region Call getVolumeInfo to check expected key and value
                        VolumeService volumeSvc = new VolumeService();

                        XMLParameter pGetVolumeInfo = new XMLParameter("volume");
                        pGetVolumeInfo.AddParameter("internal_id", volumeID);

                        CheckPoint cpGetVolumeInfo = new CheckPoint("GetVolumeInfo", "Call GetVolumeInfo to check the return value");
                        r.CheckPoints.Add(cpGetVolumeInfo);

                        XMLResult rtGetVolumeInfo = volumeSvc.getVolumeInfo(pGetVolumeInfo);
                        if (rtGetVolumeInfo.IsErrorOccured)
                        {
                            cpGetVolumeInfo.Result = TestResult.Fail;
                            cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info return error", "GetVolumeInfo", rtGetVolumeInfo.ResultContent);
                        }
                        else
                        {
                            cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info return success", "GetVolumeInfo", rtGetVolumeInfo.Message);

                            //Check the return info contain the expected key and value: parameter key="XXX" value="XXX"
                            foreach (XMLParameterNode node in epGetVolumeInfo.Parameters)
                            {
                                if (!rtGetVolumeInfo.ResultContent.Contains("parameter key=\"" + node.ParameterName + "\" value=\"" + node.ParameterValue + "\""))
                                {
                                    cpGetVolumeInfo.Result = TestResult.Fail;
                                    cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info returns wrong key-value info for: " + node.ParameterName, "GetVolumeInfo", rtGetVolumeInfo.ResultContent);
                                    continue;
                                }
                                else
                                {
                                    cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info returns correct key-value info for: " + node.ParameterName, "GetVolumeInfo", "ok");
                                }
                            }

                            if (cpGetVolumeInfo.Result != TestResult.Fail)
                            {
                                cpGetVolumeInfo.Result = TestResult.Pass;
                                cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info returns all correct info", "GetVolumeInfo", rtGetVolumeInfo.ResultContent);
                            }
                        }
                        #endregion
                    }

                    if (isDeletePatient)
                    {
                        CheckPoint cpDelete = new CheckPoint("Delete Patient", "Test delete patient");
                        r.CheckPoints.Add(cpDelete);
                        XMLResult rltDelete = patientSvc.deletePatient(patientUID);
                        if (rltDelete.IsErrorOccured)
                        {
                            cpDelete.Outputs.AddParameter("Delete created patient returns error", "Delete Patient", rltDelete.Message);
                            cpDelete.Result = TestResult.Fail;
                        }
                        else
                        {
                            cpDelete.Outputs.AddParameter("Delete created patient returns OK", "Delete Patient", rltDelete.Message);
                            cpDelete.Result = TestResult.Pass;
                        }
                    }

                    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 XMLResult createFMS(XMLParameter fmsInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("createFMS", new object[] { fmsInfo.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 1627: 1.1.12.01_Set Name for 3d objects
        public void Run_3D_SetNameFor3DObjects_Case1627()
        {
            int runCount = 0;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Set 3D Object Name");
                CheckPoint pset = new CheckPoint("Set 3DObject Name", " Check for 3d object set name");
                r.CheckPoints.Add(pset);

                string threedid = ids.InputParameters.GetParameter("threedid" + runCount.ToString()).Value;
                string testname = ids.InputParameters.GetParameter("testname" + runCount.ToString()).Value;

                XMLParameter cInputSet = new XMLParameter("volume");
                cInputSet.AddParameter("name", testname);

                XMLParameter cInputGet = new XMLParameter("volume");
                cInputGet.AddParameter("internal_id", threedid);
                cInputGet.AddParameter("path_type", "all");

                try
                {

                    VolumeService vs = new VolumeService();

                    XMLResult rslset = vs.setVolume(threedid, cInputSet);
                    if (rslset.IsErrorOccured)
                    {
                        pset.Result = TestResult.Fail;
                        pset.Outputs.AddParameter("set volume", "fail", rslset.Message);
                        SaveRound(r);
                        continue;
                    }

                    XMLResult rslget = vs.getVolumeInfo(cInputGet);

                    if (rslget.IsErrorOccured)
                    {

                        pset.Result = TestResult.Fail;
                        pset.Outputs.AddParameter("get volume", "fail", rslget.Message);
                        SaveRound(r);
                        continue;
                    }

                    string getname = string.Empty;
                    foreach (XMLParameterNode x in rslget.MultiResults[2].Parameters)
                    {
                        if (x.ParameterName == "name")
                        {
                            getname = x.ParameterValue;
                        }
                    }

                    if (getname != testname)
                    {
                        pset.Result = TestResult.Fail;
                        pset.Outputs.AddParameter("set volume", "fail", "Get Value is not equal to set Value");

                        SaveRound(r);
                        continue;
                    }

                    pset.Result = TestResult.Pass;
                    pset.Outputs.AddParameter("set volume", "Success", "OK");
                    SaveRound(r);
                }
                catch (Exception e)
                {
                    pset.Result = TestResult.Fail;
                    pset.Outputs.AddParameter("set volume", "Exception caught", e.Message);

                    SaveRound(r);
                    continue;
                }

            }
            Output();
        }
 public XMLResult setFMSInfo(XMLParameter fmsInfo, string fmsInternalID)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setFMSInfo", new object[] { fmsInfo.GenerateXML(), fmsInternalID }));
     return(this.lastResult);
 }
        // 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();
        }
 public XMLResult createRadioLogEntry(XMLParameter radioLogEntryInfoXml)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("createRadioLogEntry", new object[] { radioLogEntryInfoXml.GenerateXML() }));
     return(this.lastResult);
 }
Exemple #43
0
 public XMLResult registerLocalPAS(XMLParameter localPasInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("registerLocalPAS", new object[] { localPasInfo.GenerateXML() }));
     return(this.lastResult);
 }
 public XMLResult setRadioLogEntry(XMLParameter radioLogEntryInfoXml, string radioLogEntryInternalId)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setRadioLogEntry", new object[] { radioLogEntryInfoXml.GenerateXML(), radioLogEntryInternalId }));
     return(this.lastResult);
 }
        //Case 976: 1.3.1_GetPatient_N2_getCumulativeDose
        public void Run_Patient_GetPatient_CumulativeDose_Case976()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            string dose_value = string.Empty;
            bool isCreatePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Cumulative Dose");

                PatientService ps = new PatientService();
                ImageService igs = new ImageService();

                XMLParameter cpatientData = new XMLParameter("patient");
                XMLParameter imageData = new XMLParameter("image");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        cpatientData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "Image")
                    {
                        imageData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        if (ids.InputParameters.GetParameter(i).Key == "area_dose_product")
                            dose_value = ids.InputParameters.GetParameter(i).Value;
                    }
                }
                if (isCreatePatient)
                {
                    CheckPoint pCreate = new CheckPoint("Create Patient", "Test create");
                    r.CheckPoints.Add(pCreate);

                    XMLResult rslCreate = ps.createPatient(cpatientData);
                    if (!rslCreate.IsErrorOccured)
                    {
                        patientUID = rslCreate.SingleResult;
                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                    }
                    else
                    {
                        pCreate.Result = TestResult.Fail;
                        pCreate.Outputs.AddParameter("create", "Create patient ERR", rslCreate.Message);
                        goto CLEANUP;
                    }
                }

                if (patientUID != null)
                {
                    imageData.AddParameter("patient_internal_id", patientUID);
                    CheckPoint imageSet = new CheckPoint("Create image", "Create image");
                    r.CheckPoints.Add(imageSet);
                    XMLResult rslCreateImage = igs.createImage(imageData);
                    if (rslCreateImage.IsErrorOccured)
                    {
                        imageSet.Outputs.AddParameter("Create", "Create Image Fail", rslCreateImage.Message);
                        imageSet.Result = TestResult.Fail;
                    }
                    else
                    {
                        imageSet.Outputs.AddParameter("Create", "Create Image UID", rslCreateImage.SingleResult);
                        imageSet.Result = TestResult.Pass;

                        CheckPoint pGet = new CheckPoint("Get Patient", "Get Cumulative Dose");
                        r.CheckPoints.Add(pGet);

                        XMLResult rslGet = ps.getPatient(patientUID);
                        if (!rslGet.IsErrorOccured && rslGet.Code == 0)
                        {
                            for (int j = 0; j < rslGet.ArrayResult.Parameters.Count; j++)
                            {
                                if (rslGet.ArrayResult.Parameters[j].ParameterName == "cumulative_dose")
                                {
                                    if (double.Parse(rslGet.ArrayResult.Parameters[j].ParameterValue) == double.Parse(dose_value))
                                    {
                                        pGet.Outputs.AddParameter("Get", "Get patient OK", rslGet.ResultContent);
                                        pGet.Result = TestResult.Pass;
                                    }
                                    else
                                    {
                                        pGet.Outputs.AddParameter("Get", "Get wrong dose_value", "Expect: " + dose_value + "; actually get: " + rslGet.ArrayResult.Parameters[j].ParameterValue);
                                        pGet.Result = TestResult.Fail;
                                        goto CLEANUP;
                                    }
                                }
                            }
                        }
                        else
                        {
                            pGet.Outputs.AddParameter("Get", "Get patient Error", rslGet.ResultContent);
                            pGet.Result = TestResult.Fail;
                        }
                    }
                }

            CLEANUP:
                SaveRound(r);
                if (isCreatePatient && !string.IsNullOrEmpty(patientUID))
                {
                    ps.deletePatient(patientUID);
                }
            }
            Output();
        }
 public XMLResult exportRadioLog(XMLParameter filter)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("exportRadioLog", new object[] { filter.GenerateXML() }));
     return(this.lastResult);
 }
        // Case 1643: 1.1.03.12_List Objects - N10 - tag for image with logicon report
        public void Run_Patient_ListObjects_LogiconTagForImage_Case1643()
        {
            int runCount = 0;

            PatientService oldPatientSvc = new PatientService();
            ImportService ims = new ImportService();
            NewPatientService patientSvc = new NewPatientService();
            PatientListObjectsRequestType pListObjects = new PatientListObjectsRequestType();
            PatientListObjectsResponseType rtListObjects = new PatientListObjectsResponseType();
            PatientListObjectsResponseType rtListObjectsAfterProcess = new PatientListObjectsResponseType();

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

                try
                {
                    #region Initialize test data
                    XMLParameter pCreatePatient = new XMLParameter("patient");
                    string patientID = string.Empty;
                    string filePath = string.Empty;
                    string archivePath = string.Empty;
                    string imageID = string.Empty;
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "createPatient")
                        {
                            pCreatePatient.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "import")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "filePath")
                            {
                                filePath = ids.InputParameters.GetParameter(i).Value;
                            }
                            else if (ids.InputParameters.GetParameter(i).Key == "archivePath")
                            {
                                archivePath = ids.InputParameters.GetParameter(i).Value;
                            }
                        }
                    }

                    string tagBeforeProcess = null;
                    string tagAfterProcess = null;
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "listObjectsBeforeProcess")
                        {
                            tagBeforeProcess = ids.ExpectedValues.GetParameter(i).Value;
                        }
                        else if (ids.ExpectedValues.GetParameter(i).Step == "listObjectsAfterProcess")
                        {
                            tagAfterProcess = ids.ExpectedValues.GetParameter(i).Value;
                        }
                    }
                    #endregion

                    #region Step: Create a patient
                    CheckPoint cpCreate = new CheckPoint("Create Patient", "Create Patient");
                    r.CheckPoints.Add(cpCreate);

                    XMLResult rtCreatePatient = oldPatientSvc.createPatient(pCreatePatient);
                    if (rtCreatePatient.IsErrorOccured)
                    {
                        cpCreate.Result = TestResult.Fail;
                        cpCreate.Outputs.AddParameter("Create returns error:", "Create Patient", rtCreatePatient.Message);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        patientID = rtCreatePatient.SingleResult;
                        pListObjects.patientInternalId = patientID;
                        pListObjects.current = true;
                        pListObjects.currentSpecified = true;
                        cpCreate.Outputs.AddParameter("Patient ID:", "Create Patient", rtCreatePatient.SingleResult);
                        cpCreate.Result = TestResult.Pass;
                    }
                    #endregion

                    #region Step: Prepare a RVG image
                    CheckPoint cpImport = new CheckPoint("Import Image", "Test import");
                    r.CheckPoints.Add(cpImport);

                    XMLResult rtlImport = ims.importObject(patientID, "", filePath, archivePath, false, "false");
                    if (rtlImport.IsErrorOccured)
                    {
                        cpImport.Result = TestResult.Fail;
                        cpImport.Outputs.AddParameter("import", "Import image fail", rtlImport.ResultContent);
                    }
                    else
                    {
                        cpImport.Result = TestResult.Pass;
                        cpImport.Outputs.AddParameter("import", "Import image OK", rtlImport.ResultContent);
                        imageID = rtlImport.SingleResult;
                    }
                    #endregion

                    #region Step: Check the tag before do logicon processing
                    CheckPoint cpListObjects = new CheckPoint("List Object", "List Object before process");
                    r.CheckPoints.Add(cpListObjects);
                    rtListObjects = patientSvc.listObjects(pListObjects);
                    if (patientSvc.LastReturnXMLValidateResult.isValid && rtListObjects.status.code == 0)
                    {
                        cpListObjects.Result = TestResult.Pass;
                        cpListObjects.Outputs.AddParameter("List Object Return Pass", "List Object", "The web service return is OK!: " + patientSvc.LastReturnXML);
                    }
                    else
                    {
                        cpListObjects.Result = TestResult.Fail;
                        cpListObjects.Outputs.AddParameter("List Object Return Fail", "List Object", "The web service return is ERROR! : " + patientSvc.LastReturnXML);
                        goto CLEANUP;
                    }

                    CheckPoint cpLogiconTag = new CheckPoint("Tag", "Check the logicon tag before processing");
                    if (tagBeforeProcess == rtListObjects.presentationStates[0].image.tags)
                    {
                        cpLogiconTag.Outputs.AddParameter("Check Tag", "List Object", "List Object return tag as expect: " + patientSvc.LastReturnXML);
                        cpLogiconTag.Result = TestResult.Pass;
                    }
                    else
                    {
                        cpLogiconTag.Outputs.AddParameter("List Object Return Result unexpect", "List Object", "List Object return unexpected tag!" + patientSvc.LastReturnXML);
                        cpLogiconTag.Result = TestResult.Fail;
                    }
                    #endregion

                    #region Step: Do logicon processing
                    GenericInstanceService genericInstanceSvc = new GenericInstanceService();
                    genericInstanceSvc.DoLogiconProcess(r, imageID);
                    #endregion

                    #region Step: Check the tag after do logicon processing
                    CheckPoint cpListObjectsAfterProcess = new CheckPoint("List Object", "List Object after process");
                    r.CheckPoints.Add(cpListObjectsAfterProcess);
                    rtListObjectsAfterProcess = patientSvc.listObjects(pListObjects);
                    if (patientSvc.LastReturnXMLValidateResult.isValid && rtListObjectsAfterProcess.status.code == 0)
                    {
                        cpListObjectsAfterProcess.Result = TestResult.Pass;
                        cpListObjectsAfterProcess.Outputs.AddParameter("List Object Return Pass", "List Object", "The web service return is OK!");
                    }
                    else
                    {
                        cpListObjectsAfterProcess.Result = TestResult.Fail;
                        cpListObjectsAfterProcess.Outputs.AddParameter("List Object Return Fail", "List Object", "The web service return is ERROR! : " + patientSvc.LastReturnXML);
                        goto CLEANUP;
                    }

                    CheckPoint cpLogiconTagAfterProcess = new CheckPoint("Tag", "Check the logicon tag before processing");
                    if (tagAfterProcess == rtListObjectsAfterProcess.presentationStates[0].image.tags)
                    {
                        cpListObjectsAfterProcess.Outputs.AddParameter("Check Tag", "List Object", "List Object return tag as expect: " + patientSvc.LastReturnXML);
                        cpListObjectsAfterProcess.Result = TestResult.Pass;
                    }
                    else
                    {
                        cpListObjectsAfterProcess.Outputs.AddParameter("List Object Return Result unexpect", "List Object", "List Object return unexpected tag!" + patientSvc.LastReturnXML);
                        cpListObjectsAfterProcess.Result = TestResult.Fail;
                    }
                    #endregion

                    #region Delete patient
                CLEANUP:
                    CheckPoint cpDelete = new CheckPoint("Delete Patient", "Delete Patient");
                    r.CheckPoints.Add(cpDelete);

                    XMLResult rtDeletePatient = oldPatientSvc.deletePatient(patientID);
                    if (rtDeletePatient.IsErrorOccured)
                    {
                        cpDelete.Result = TestResult.Fail;
                        cpDelete.Outputs.AddParameter("Delete returns error:", "Delete Patient", rtDeletePatient.Message);
                    }
                    else
                    {
                        cpDelete.Outputs.AddParameter("Delete return success:", "Delete Patient", rtDeletePatient.Message);
                        cpDelete.Result = TestResult.Pass;
                    }
                    #endregion

                    SaveRound(r);
                }
                catch (Exception ex)
                {
                    CheckPoint cp = new CheckPoint();
                    r.CheckPoints.Add(cp);
                    cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.Message);
                    cp.Result = TestResult.Fail;
                    SaveRound(r);
                }
            }
            Output();
        }
        //Case 1073: 1.3.7_GetPresentationStateInfo_N06_Import image and check the DICOM info value is correct in GetPSInfo return
        public void Run_PS_Import_GetPSInfo_Case1073()
        {
            int runCount = 0;

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

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

                try
                {
                    string patientID = null;
                    string objectFileFullPath = null;
                    XMLParameter getPSInfoReturnParam = new XMLParameter("DICOM INFO in getPSInfo return");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "import")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "patientInternalID")
                            {
                                patientID = ids.InputParameters.GetParameter(i).Value;
                            }
                            if (ids.InputParameters.GetParameter(i).Key == "objectFileFullPath")
                            {
                                objectFileFullPath = ids.InputParameters.GetParameter(i).Value;
                            }
                        }
                    }

                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "getPSInfo")
                        {
                            // Add the key to check and the expected value
                            getPSInfoReturnParam.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                    }

                    #region Step 1: import the image
                    CheckPoint pImport = new CheckPoint("Import", "Import the prepared DICOM image file");
                    r.CheckPoints.Add(pImport);

                    ImportService import = new ImportService();
                    XMLResult importResult = import.importObject(patientID, null, objectFileFullPath, null, true, null);

                    if (importResult.IsErrorOccured)
                    {
                        pImport.Result = TestResult.Fail;

                        System.Diagnostics.Debug.Print("Call import service to import DICOM image file returns error.");
                        pImport.Outputs.AddParameter("import", "Import DICOM image file", importResult.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        pImport.Result = TestResult.Pass;

                        System.Diagnostics.Debug.Print("Call import service to import DICOM image file succeeds.");
                        pImport.Outputs.AddParameter("import", "Import DICOM image file", importResult.Message);
                    }
                    #endregion

                    #region Step 2: call getPSInfo
                    CheckPoint pGetPSInfo = new CheckPoint("GetPSInfo", "Get the presentionstate info");
                    r.CheckPoints.Add(pGetPSInfo);

                    PresentationStateService psService = new PresentationStateService();

                    XMLParameterCollection getPSInfoParam = new XMLParameterCollection();

                    for (int i = 0; i < importResult.MultiResults.Count; i++)
                    {
                        if (importResult.MultiResults[i].Name.ToLower() == "presentationstate")
                        {
                            getPSInfoParam.Add(importResult.MultiResults[i]);
                            break; // get the PS ID, end for loop
                        }
                    }

                    XMLResult getPSResult = psService.getPresentationStateInfo(getPSInfoParam);

                    if (getPSResult.IsErrorOccured)
                    {
                        pGetPSInfo.Result = TestResult.Fail;

                        System.Diagnostics.Debug.Print("Call getPSInfo returns error.");
                        pGetPSInfo.Outputs.AddParameter("getPSInfo", "Get the presentionstate info", importResult.Message);

                        SaveRound(r);
                        break; // There is error, end test case
                    }
                    else
                    {
                        pGetPSInfo.Result = TestResult.Pass;

                        System.Diagnostics.Debug.Print("Call getPSInfo succeeds.");
                        pGetPSInfo.Outputs.AddParameter("import", "Get the presentionstate info", importResult.Message);
                    }
                    #endregion

                    #region Step 3: check the dicom info in getPSInfo return
                    CheckPoint pDICOMInfo = new CheckPoint("DICOMInfo", "Check the DICOM info in the returned presentionstate info");
                    r.CheckPoints.Add(pDICOMInfo);

                    bool isValueEqual = false;
                    bool isKeyShow = false;

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

                        int i = 0;
                        for (i = 0; i < getPSResult.DicomArrayResult.Parameters.Count; i++)
                        {
                            if (getPSResult.DicomArrayResult.Parameters[i].ParameterName.ToLower() == "dicom_info")
                            {
                                if (getPSResult.DicomArrayResult.Parameters[i].ParameterValue.Contains("<parameter key=\"" + psNode.ParameterName + "\" value=\"" + psNode.ParameterValue + "\" />"))   // <parameter key="dcm_modality" value="PX" />
                                {
                                    isKeyShow = true;
                                    isValueEqual = true;
                                    break;
                                }
                            }
                            //if (psNode.ParameterName == getPSResult.DicomArrayResult.Parameters[i].ParameterName)  // need change here to check the dicom info
                            //{
                            //    isKeyShow = true;
                            //    isValueEqual = string.Equals(psNode.ParameterValue, getPSResult.DicomArrayResult.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
                        {
                            pDICOMInfo.Result = TestResult.Fail;

                            if (isKeyShow)
                            {
                                System.Diagnostics.Debug.Print("The return value in getPSInfo does not match the expected.");
                                pDICOMInfo.Outputs.AddParameter("DICOMInfo", "Check the DICOM info in the returned presentionstate info", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + getPSResult.MultiResults[0].Parameters[i].ParameterValue);
                            }
                            else
                            {
                                System.Diagnostics.Debug.Print("The return value in getPSInfo does not contain the node: " + psNode.ParameterName);
                                pDICOMInfo.Outputs.AddParameter("DICOMInfo", "Check the DICOM info in the returned presentionstate info", "The return value in getPSInfo does not contain the node: " + psNode.ParameterName);
                            }

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

                    if (isValueEqual)
                    {
                        pDICOMInfo.Result = TestResult.Pass;

                        System.Diagnostics.Debug.Print("The return values in getPSInfo all match the expected.");
                        pDICOMInfo.Outputs.AddParameter("DICOMInfo", "Check the DICOM info in the returned presentionstate info", "The return values in getPSInfo all match the expected");
                    }
                    #endregion

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

            Output();
        }
        //Case 34: 1.3.1_SetPatient_Normal
        public void Run_Patient_SetPatient_Normal_Case34()
        {
            int runCount = 0;
            int matchItem = 1;
            string patientUID = string.Empty;
            bool isCreatePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "set patient");
                CheckPoint pCreate = new CheckPoint("Create Patient", "Test create");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();

                XMLParameter cpatientData = new XMLParameter("patient");
                XMLParameter spatientData = new XMLParameter("patient");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        cpatientData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "set")
                    {
                        spatientData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        matchItem++;
                    }
                }
                if (isCreatePatient)
                {
                    XMLResult rslCreate = ps.createPatient(cpatientData);
                    if (!rslCreate.IsErrorOccured)
                    {
                        patientUID = rslCreate.SingleResult;
                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                        //System.Diagnostics.Debug.Print("PAS: Create patient UID:{0}",patientUID);
                    }
                    else
                    {
                        pCreate.Result = TestResult.Fail;
                        pCreate.Outputs.AddParameter("create", "Create patient ERR", rslCreate.Message);
                        //System.Diagnostics.Debug.Print("PAS: Create patient ERR:{0}",rslCreate.Message);
                    }
                }

                CheckPoint pSet = new CheckPoint("Set Patient", "Test set");
                r.CheckPoints.Add(pSet);

                XMLResult rslSet = ps.setPatient(spatientData, patientUID);
                System.Threading.Thread.Sleep(500);

                XMLResult rslGet = ps.getPatient(patientUID);

                if (rslSet.IsErrorOccured || rslGet.IsErrorOccured)
                {
                    pSet.Result = TestResult.Fail;
                    pSet.Outputs.AddParameter("set", "Set patient ERR", patientUID);
                }

                for (int j = 0; j < rslGet.ArrayResult.Length; j++)
                {
                    for (int k = 0; k < spatientData.Length; k++)
                    {
                        if (rslGet.ArrayResult.GetParameterName(j) == spatientData.GetParameterName(k)
                          && rslGet.ArrayResult.GetParameterValue(j) == spatientData.GetParameterValue(k))
                            matchItem--;
                    }
                }
                //System.Diagnostics.Debug.Print("PAS: Get patient match:{0}",matchItem - 1);
                if (matchItem == 1)
                {
                    pSet.Outputs.AddParameter("set", "Set patient OK", patientUID);
                }
                else
                {
                    pSet.Result = TestResult.Fail;
                    pSet.Outputs.AddParameter("set", "Set patient ERR", rslSet.Message);
                }

                XMLResult delPat = ps.deletePatient(patientUID);
                if (!delPat.IsErrorOccured)
                {
                    pSet.Outputs.AddParameter("Delete created patient OK", "Delete Patient", delPat.Message);
                    pSet.Result = TestResult.Pass;
                }

                SaveRound(r);
            }
            Output();
        }
        //Case 7: 1.3.7_CreatePresentationState_Normal
        public void Run_PS_CreatePresentationState_Normal_Case7()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Test PresentationState Service: createPresentationState");

                try
                {
                    #region Parameter initialize
                    string imageInternalID = string.Empty;
                    XMLParameter p_CreateImage = new XMLParameter("image");
                    XMLParameter p_CreatePresentationState = new XMLParameter("presentationstate");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "createImage")
                        {
                            p_CreateImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                        if (ids.InputParameters.GetParameter(i).Step == "createPresentationState")
                        {
                            p_CreatePresentationState.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                    }

                    bool ep_isReturnOK = true;
                    string ep_ReturnValue = string.Empty;
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "createPresentationState")
                        {
                            if (ids.ExpectedValues.GetParameter(i).Key == "returnState")
                            {
                                if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("pass"))
                                {
                                    ep_isReturnOK = true;
                                }
                                else if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("fail"))
                                {
                                    ep_isReturnOK = false;
                                }
                            }
                            else if (ids.ExpectedValues.GetParameter(i).Key == "returnMessage")
                            {
                                ep_ReturnValue = ids.ExpectedValues.GetParameter(i).Value;
                            }
                        }
                    }
                    #endregion

                    ImageService imageService = new ImageService();
                    PresentationStateService psService = new PresentationStateService();

                    #region Step 1: Call ImageService.createImage to create a new image
                    CheckPoint cp_CreateImage = new CheckPoint("Image create", "Call imageService.createImage to create a new image");
                    r.CheckPoints.Add(cp_CreateImage);

                    XMLResult rt_CreateImage = imageService.createImage(p_CreateImage);
                    if (rt_CreateImage.IsErrorOccured)
                    {
                        cp_CreateImage.Result = TestResult.Fail;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns error", rt_CreateImage.Message);

                        SaveRound(r);
                        continue; // There is error when create image, end current run
                    }
                    else
                    {
                        cp_CreateImage.Result = TestResult.Pass;
                        cp_CreateImage.Outputs.AddParameter("create", "Create image returns success", rt_CreateImage.Message);
                        imageInternalID = rt_CreateImage.SingleResult;
                    }
                    #endregion

                    #region Step 2: Call PresentationStateService.CreatePresentationState to create a PS for the image
                    CheckPoint cp_CreatePresentationState = new CheckPoint("Create PS", "Call PresentationStateService.CreatePresentationState to create a new ps");
                    r.CheckPoints.Add(cp_CreatePresentationState);

                    XMLResult rt_CreatePresentationState = psService.createPresentationState(imageInternalID, p_CreatePresentationState);
                    if (true == ep_isReturnOK) // Expect the call returns OK
                    {
                        if (rt_CreatePresentationState.IsErrorOccured)
                        {
                            cp_CreatePresentationState.Result = TestResult.Fail;
                            cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error", rt_CreatePresentationState.Message);
                        }
                        else
                        {
                            cp_CreatePresentationState.Result = TestResult.Pass;
                            cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns success", rt_CreatePresentationState.Message);
                        }
                    }
                    else // Expect the call return error
                    {
                        if (rt_CreatePresentationState.IsErrorOccured) // There is error
                        {
                            if (rt_CreatePresentationState.Message.ToLower().Contains(ep_ReturnValue.ToLower()))
                            {
                                cp_CreatePresentationState.Result = TestResult.Pass;
                                cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error as expected", rt_CreatePresentationState.Message);
                            }
                            else
                            {
                                cp_CreatePresentationState.Result = TestResult.Fail;
                                cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error message not match the expected. ", "Expect: " + ep_ReturnValue + "; Actually returns: " + rt_CreatePresentationState.Message);
                            }
                        }
                        else // There is no error
                        {
                            cp_CreatePresentationState.Result = TestResult.Fail;
                            cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS not returns error as expected. ", "Actually returns: " + rt_CreatePresentationState.Message);
                        }
                    }
                    #endregion

                    #region Step 3: Call ImageService.deleteImage to delete the created image
                    CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image");
                    r.CheckPoints.Add(cp_DeleteImage);

                    XMLResult rt_DeleteImage = imageService.deleteImage(imageInternalID, new XMLParameter("preferences"));
                    if (rt_DeleteImage.IsErrorOccured)
                    {
                        cp_DeleteImage.Result = TestResult.Fail;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns error", rt_DeleteImage.Message);
                    }
                    else
                    {
                        cp_DeleteImage.Result = TestResult.Pass;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns success", rt_DeleteImage.Message);
                    }
                    #endregion

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

            Output();
        }
        //Case 992: 1.3.7_GetPresentationStateDescription_N02_WhenPSNotExist
        public void Run_PS_GetPresentationStateDescription_PSNotExist_Case992()
        {
            int runCount = 0;
            string patientUID = string.Empty;
            bool isCreatePatient = false;
            bool isDeletePatient = false;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                isCreatePatient = false;
                isDeletePatient = false;
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Import image");
                CheckPoint pCreate = new CheckPoint("Create Patient", "Test create");
                r.CheckPoints.Add(pCreate);
                PatientService ps = new PatientService();
                ImportService ims = new ImportService();
                PresentationStateService pss = new PresentationStateService();

                XMLParameter pa = new XMLParameter("patient");
                XMLParameter ia = new XMLParameter("import");
                //XMLParameter psa = new XMLParameter("presentationstate");

                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "create")
                    {
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        isCreatePatient = true;
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "import")
                    {
                        ia.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "delete")
                    {
                        isDeletePatient = true;
                    }
                }
                if (isCreatePatient)
                {
                    XMLResult result = ps.createPatient(pa);
                    if (!result.IsErrorOccured)
                    {
                        patientUID = result.SingleResult;
                        pCreate.Result = TestResult.Pass;
                        pCreate.Outputs.AddParameter("create", "Create patient UID", patientUID);
                    }
                }

                CheckPoint pImport = new CheckPoint("Import Image", "Test import");
                r.CheckPoints.Add(pImport);

                string filePath = string.Empty;
                string archivePath = string.Empty;
                bool move = false;
                for (int c = 0; c < ia.Length; c++)
                {
                    if (ia.GetParameterName(c) == "path")
                        filePath = ia.GetParameterValue(c);
                    if (ia.GetParameterName(c) == "archivePath")
                        archivePath = ia.GetParameterValue(c);
                    if (ia.GetParameterName(c) == "move")
                    {
                        if (ia.GetParameterValue(c) == "true")
                            move = true;
                    }
                }

                XMLResult rslImport = ims.importObject(patientUID, "", filePath, archivePath, move, "false");

                if (rslImport.IsErrorOccured)
                {
                    pImport.Result = TestResult.Fail;
                    pImport.Outputs.AddParameter("import", "Import image fail", rslImport.Message);
                    pImport.Outputs.AddParameter("import", "Import image error code", rslImport.Code.ToString());
                }
                else
                {
                    pImport.Result = TestResult.Pass;
                    pImport.Outputs.AddParameter("import", "Import image OK", rslImport.Message);

                    for (int findPs = 0; findPs < rslImport.MultiResults.Count; findPs++)
                    {
                        if (rslImport.MultiResults[findPs].Name == "presentationstate")
                        {
                            string psUID = rslImport.MultiResults[findPs].Parameters[0].ParameterValue;
                            XMLResult psreturn = pss.getPresentationState(psUID);

                            CheckPoint pGetPS = new CheckPoint("Get Presentation State", "PS Desc");
                            r.CheckPoints.Add(pGetPS);
                            if (psreturn.MultiResults.Count == 1 && !string.IsNullOrEmpty(psreturn.MultiResults[0].GetParameterValueByName("image_internal_id")) && string.IsNullOrEmpty(psreturn.MultiResults[0].GetParameterValueByName("general.xml")) && string.IsNullOrEmpty(psreturn.MultiResults[0].GetParameterValueByName("processing.xml")) && string.IsNullOrEmpty(psreturn.MultiResults[0].GetParameterValueByName("annotation.xml")))
                            {
                                pGetPS.Result = TestResult.Pass;
                                pGetPS.Outputs.AddParameter("get presentation state", "get presentation state as expect", psreturn.ResultContent);
                            }
                            else
                            {
                                pGetPS.Result = TestResult.Fail;
                                pGetPS.Outputs.AddParameter("get presentation state", "get presentation state not as expect", psreturn.ResultContent);
                            }
                        }
                    }
                }
                if (isDeletePatient)
                {
                    XMLResult rltDelete = ps.deletePatient(patientUID);
                    if (!rltDelete.IsErrorOccured)
                    {
                        pCreate.Outputs.AddParameter("Delete created patient", "Delete Patient", rltDelete.Message);
                    }
                }
                SaveRound(r);
            }
            Output();
        }
 public XMLResult createStudy(XMLParameter studyInfo)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("createStudy", new object[] { studyInfo.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 78: 1.3.7_GetPresentationStateInfo_Exception
        public void Run_PS_GetPresentationStateInfo_Exception_Case78()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Test PresentationState Service: getPresentationStateInfo");

                try
                {
                    #region Parameter initialize
                    //Input parameters
                    XMLParameterCollection p_getPresentationStateInfo = new XMLParameterCollection();
                    XMLParameter p_PSID = new XMLParameter("presentationstate");
                    XMLParameter p_Preferences = new XMLParameter("preferences");
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "getPresentationStateInfo")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "internal_id")
                            {
                                p_PSID.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                            }
                            else if (ids.InputParameters.GetParameter(i).Key == "teeth_number_notation")
                            {
                                p_Preferences.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                            }
                        }
                    }
                    p_getPresentationStateInfo.Add(p_PSID);
                    p_getPresentationStateInfo.Add(p_Preferences);

                    // Output value
                    bool ep_isReturnOK = true;
                    string ep_ReturnValue = string.Empty;
                    string ep_imageID = string.Empty;
                    XMLParameter ep_getPresentationStateInfo = new XMLParameter("presentationstate");
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "getPresentationStateInfo")
                        {
                            switch (ids.ExpectedValues.GetParameter(i).Key)
                            {
                                case "returnState":
                                    {
                                        if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("pass"))
                                        {
                                            ep_isReturnOK = true;
                                        }
                                        else if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("fail"))
                                        {
                                            ep_isReturnOK = false;
                                        }
                                        break;
                                    }
                                case "returnMessage":
                                    {
                                        ep_ReturnValue = ids.ExpectedValues.GetParameter(i).Value;
                                        break;
                                    }
                                default:
                                    {
                                        ep_getPresentationStateInfo.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                                        break;
                                    }
                            }
                        }
                    }
                    #endregion

                    PresentationStateService psService = new PresentationStateService();

                    #region Step 1: Call PresentationStateService.GetPresentationStateInfo to get a PS for the image
                    CheckPoint cp_GetPresentationStateInfo = new CheckPoint("Get PS Info", "Call PresentationStateService.GetPresentationStateInfo to get ps info");
                    r.CheckPoints.Add(cp_GetPresentationStateInfo);

                    XMLResult rt_GetPresentationStateInfo = psService.getPresentationStateInfo(p_getPresentationStateInfo);
                    if (true == ep_isReturnOK) // Expect the call returns OK
                    {
                        if (rt_GetPresentationStateInfo.IsErrorOccured)
                        {
                            cp_GetPresentationStateInfo.Result = TestResult.Fail;
                            cp_GetPresentationStateInfo.Outputs.AddParameter("get", "Get PS returns error", rt_GetPresentationStateInfo.Message);
                        }
                        else
                        {
                            cp_GetPresentationStateInfo.Result = TestResult.Pass;
                            cp_GetPresentationStateInfo.Outputs.AddParameter("get", "Get PS returns succeed", rt_GetPresentationStateInfo.Message);

                            // Check the return value is correct
                            #region Step 2: Check the values in PresentationStateService.getPresentationStateInfo return are correct
                            CheckPoint cp_getPSInfoReturn = new CheckPoint("Get PS Info", "Check the values in PresentationStateService.GetPresentationStateInfo return");
                            r.CheckPoints.Add(cp_getPSInfoReturn);

                            bool isValueEqual = false;
                            bool isKeyShow = false;

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

                                int i = 0;
                                for (i = 0; i < rt_GetPresentationStateInfo.MultiResults[0].Parameters.Count; i++)
                                {
                                    if (psNode.ParameterName == rt_GetPresentationStateInfo.MultiResults[0].Parameters[i].ParameterName)
                                    {
                                        isKeyShow = true;
                                        isValueEqual = string.Equals(psNode.ParameterValue, rt_GetPresentationStateInfo.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
                                {
                                    cp_getPSInfoReturn.Result = TestResult.Fail;

                                    if (isKeyShow)
                                    {
                                        System.Diagnostics.Debug.Print("The return value in getPresentationStateInfo does not match the expected.");
                                        cp_getPSInfoReturn.Outputs.AddParameter("PS Info", "Check the values in PresentationStateService.getPresentationStateInfo return", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rt_GetPresentationStateInfo.MultiResults[0].Parameters[i].ParameterValue);
                                    }
                                    else
                                    {
                                        System.Diagnostics.Debug.Print("The return value in getPresentationStateInfo does not contain the node: " + psNode.ParameterName);
                                        cp_getPSInfoReturn.Outputs.AddParameter("PS Info", "Check the values in PresentationStateService.getPresentationStateInfo return", "The return value does not contain the node: " + psNode.ParameterName);
                                    }

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

                            if (isValueEqual)
                            {
                                cp_getPSInfoReturn.Result = TestResult.Pass;

                                System.Diagnostics.Debug.Print("The return values in getPresentationStateInfo all match the expected.");
                                cp_getPSInfoReturn.Outputs.AddParameter("PS Info", "Check the values in PresentationStateService.getPresentationStateInfo return", "The return values all match the expected");
                            }
                            #endregion
                        }
                    }
                    else // Expect the call return error
                    {
                        if (rt_GetPresentationStateInfo.IsErrorOccured) // There is error
                        {
                            if (rt_GetPresentationStateInfo.Message.ToLower().Contains(ep_ReturnValue.ToLower()))
                            {
                                cp_GetPresentationStateInfo.Result = TestResult.Pass;
                                cp_GetPresentationStateInfo.Outputs.AddParameter("get", "Get PS Info returns error as expected", rt_GetPresentationStateInfo.Message);
                            }
                            else
                            {
                                cp_GetPresentationStateInfo.Result = TestResult.Fail;
                                cp_GetPresentationStateInfo.Outputs.AddParameter("get", "Get PS Info returns error message not match the expected. ", "Expect: " + ep_ReturnValue + "; Actually returns: " + rt_GetPresentationStateInfo.Message);
                            }
                        }
                        else // There is no error
                        {
                            cp_GetPresentationStateInfo.Result = TestResult.Fail;
                            cp_GetPresentationStateInfo.Outputs.AddParameter("get", "Get PS Info not returns error as expected. ", "Actually returns: " + rt_GetPresentationStateInfo.Message);
                        }
                    }
                    #endregion

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

            Output();
        }
Exemple #54
0
 public XMLResult getVolumeInfo(XMLParameter filter)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("getVolumeInfo", new object[] { filter.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 1094: 1.3.7_WorkFlow_ImportDICOMImage+GetPresentationStateInfo_RadioLogInformation
        public void Run_PS_ImportDicom_RadioLog_Case1094()
        {
            //int runCount = this.Input.Repetition;

            int runCount = 0; // this is the initial run count. Use this count to repeat different test data set.

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

                //Mark the check point here to indicate what's the check point here
                CheckPoint p1 = new CheckPoint("createPatient", "Setup environment of createPatient");
                CheckPoint p2 = new CheckPoint("importObject", "Setup environment of importObject");
                CheckPoint p3 = new CheckPoint("getImageInfo", "Test getImageInfo");
                CheckPoint p4 = new CheckPoint("getPresentationStateInfo", "Test getPresentationStateInfo");

                r.CheckPoints.Add(p1);
                r.CheckPoints.Add(p2);
                r.CheckPoints.Add(p3);
                r.CheckPoints.Add(p4);

                //create required PAS service instaces here
                PatientService pats = new PatientService();
                ImportService ims = new ImportService();
                ImageService img = new ImageService();
                PresentationStateService ps = new PresentationStateService();

                //create input parameters here, it may include XML path type and string type value
                XMLParameter pa1 = new XMLParameter("patient");
                XMLParameter pa2 = new XMLParameter("importObject");
                XMLParameter pa3 = new XMLParameter("image");
                XMLParameter ps4 = new XMLParameter("presentationstate");
                XMLParameterCollection pa4 = new XMLParameterCollection();

                try
                {
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        switch (ids.InputParameters.GetParameter(i).Step)
                        {
                            case "createPatient":
                                pa1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            case "importObject":
                                pa2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                                break;
                            default:
                                Console.WriteLine("There is no valid selection when parse input parameters.");
                                break;
                        }
                    }

                    //If we need change parameter by specific logic, please put code here

                    //Get service result
                    //Step1 result

                    XMLResult step1_result = pats.createPatient(pa1);

                    //Log step1 service output
                    if (step1_result.IsErrorOccured)
                    {
                        p1.Result = TestResult.Fail;
                        p1.Outputs.AddParameter("Step 1: createPatient", "Error", step1_result.ResultContent);
                        SaveRound(r);
                        continue;
                    }

                    p1.Result = TestResult.Pass;
                    p1.Outputs.AddParameter("Step 1: createPatient", "Success", step1_result.ResultContent);

                    //Change input parameter according the output of Step1
                    pa2.AddParameter("patientInternalId", step1_result.SingleResult);

                    //Step2 result

                    //if objectFileFullPath is empty string, skip step2
                    if (pa2.GetParameterValueByName("objectFileFullPath") != null && pa2.GetParameterValueByName("objectFileFullPath") != "")
                    {
                        XMLResult step2_result = ims.importObject(pa2.GetParameterValueByName("patientInternalId"), "", pa2.GetParameterValueByName("objectFileFullPath"), "", false, "");

                        //Log step2 service output
                        if (step2_result.IsErrorOccured)
                        {
                            p2.Result = TestResult.Fail;
                            p2.Outputs.AddParameter("Step 2: importObject", "Error", step2_result.ResultContent);
                            SaveRound(r);
                            continue;
                        }

                        p2.Result = TestResult.Pass;
                        p2.Outputs.AddParameter("Step 2: importObject", "Success", step2_result.ResultContent);

                        //Change input parameter according the output of Step2
                        // if step2 is skipped, step3 input has no need parameter of internal_id

                        for (int i = 0; i < step2_result.MultiResults.Count; i++)
                        {
                            if (step2_result.MultiResults[i].Name == "image")
                            {
                                pa3.AddParameter("internal_id", step2_result.MultiResults[i].GetParameterValueByIndex(i));
                            }
                            if (step2_result.MultiResults[i].Name == "presentationstate")
                            {
                                pa4.Add(step2_result.MultiResults[i]);
                            }
                        }
                    }

                    //Step3 result
                    XMLResult step3_result = img.getImageInfo(pa3);

                    if (step3_result.IsErrorOccured)
                    {
                        p3.Result = TestResult.Fail;
                        p3.Outputs.AddParameter("Step 3: getImageInfo", "The call 'getImageInfo' returns error: ", step3_result.Message);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        p3.Result = TestResult.Pass; // Assume test pass at first, check the details later to update this
                    }

                    //Log step3 service output
                    int expectedParameterCount = 0;
                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getImageInfo")
                        {
                            expectedParameterCount++;
                        }
                    }

                    string dicom_info_getImageInfo = step3_result.DicomArrayResult.GetParameterValueByName("dicom_info");

                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getImageInfo")
                        {
                            // The dicom_info in return does not match the expected key and value
                            if (false == dicom_info_getImageInfo.Contains("<parameter key=\"" + ids.ExpectedValues.Parameters[index].Key + "\" value=\"" + ids.ExpectedValues.Parameters[index].Value + "\" />"))
                            {
                                p3.Result = TestResult.Fail;
                                p3.Outputs.AddParameter("Step 3: getImageInfo", "Error: the expect value does not match: " + ids.ExpectedValues.Parameters[index].Key + ". Actually get dicom_Info: ", dicom_info_getImageInfo);
                                break;
                            }
                        }
                    }
                    if (p3.Result == TestResult.Pass)
                    {
                        p3.Outputs.AddParameter("Step 3: getImageInfo", "The dicom info all match the expected value", dicom_info_getImageInfo);
                    }

                    //Step4 result
                    XMLResult step4_result = ps.getPresentationStateInfo(pa4);

                    if (step4_result.IsErrorOccured)
                    {
                        p4.Result = TestResult.Fail;
                        p4.Outputs.AddParameter("Step 4: getPresentationStateInfo", "The call 'getPresentationStateInfo' returns error: ", step4_result.Message);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        p4.Result = TestResult.Pass;
                    }

                    expectedParameterCount = 0;  //count of expected parameters on getPresentationStateInfo
                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getPresentationStateInfo")
                        {
                            expectedParameterCount++;
                        }
                    }

                    string dicom_info_getPSInfo = step4_result.DicomArrayResult.GetParameterValueByName("dicom_info");

                    for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                    {
                        if (ids.ExpectedValues.Parameters[index].Step == "getPresentationStateInfo")
                        {
                            if (false == dicom_info_getPSInfo.Contains("<parameter key=\"" + ids.ExpectedValues.Parameters[index].Key + "\" value=\"" + ids.ExpectedValues.Parameters[index].Value + "\" />"))
                            {
                                p4.Result = TestResult.Fail;
                                p4.Outputs.AddParameter("Step 4: getPresentationStateInfo", "Error: the expect dicom value does not match: " + ids.ExpectedValues.Parameters[index].Key + ". Actually get dicom_Info: ", dicom_info_getPSInfo);
                                break;
                            }
                        }
                    }

                    if (p4.Result == TestResult.Pass)
                    {
                        p4.Outputs.AddParameter("Step 4: getPresentationStateInfo", "Success: the expect dicom value all match the expected", dicom_info_getPSInfo);
                    }

                    SaveRound(r);

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

            //Save service log as xml file
            Output();
        }
Exemple #56
0
 public XMLResult listPresentationState(XMLParameter filter, string imageInternalID)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("listPresentationState", new object[] { filter.GenerateXML(), imageInternalID }));
     return(this.lastResult);
 }
        //Case 10: 1.3.7_SetPresentationStateInfo_Normal
        public void Run_PS_SetPresentationStateInfo_Normal_Case10()
        {
            int runCount = 0;

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

                try
                {
                    #region Parameter initialize
                    bool isImportImage = false;
                    string psID = null;
                    string imageID = null;

                    //Input parameters
                    string p_Import_patientId = null;
                    string p_Import_objectFileFullPath = null;
                    XMLParameter p_setPresentationStateInfo = new XMLParameter("presentationstate");
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "import")
                        {
                            isImportImage = true;
                            if (ids.InputParameters.GetParameter(i).Key == "patientInternalId")
                            {
                                p_Import_patientId = ids.InputParameters.GetParameter(i).Value;
                            }
                            else if (ids.InputParameters.GetParameter(i).Key == "objectFileFullPath")
                            {
                                p_Import_objectFileFullPath = ids.InputParameters.GetParameter(i).Value;
                            }
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "setPresentationStateInfo")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "presentationStateInternalID")
                            {
                                psID = ids.InputParameters.GetParameter(i).Value;
                            }
                            else
                            {
                                p_setPresentationStateInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                            }
                        }
                    }

                    // Output value
                    bool ep_isSetPSInfoReturnOK = true;
                    string ep_SetPSInfoReturnMessage = string.Empty;
                    XMLParameter ep_getPresentationStateInfo = new XMLParameter();
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Step == "setPresentationStateInfo")
                        {
                            switch (ids.ExpectedValues.GetParameter(i).Key)
                            {
                                case "returnState":
                                    {
                                        if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("pass"))
                                        {
                                            ep_isSetPSInfoReturnOK = true;
                                        }
                                        else if (ids.ExpectedValues.GetParameter(i).Value.ToLower().Equals("fail"))
                                        {
                                            ep_isSetPSInfoReturnOK = false;
                                        }
                                        break;
                                    }
                                case "returnMessage":
                                    {
                                        ep_SetPSInfoReturnMessage = ids.ExpectedValues.GetParameter(i).Value;
                                        break;
                                    }
                                default:
                                    break;
                            }
                        }
                        else if (ids.ExpectedValues.GetParameter(i).Step == "getPresentationStateInfo")
                        {
                            ep_getPresentationStateInfo.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value);
                        }
                    }
                    #endregion

                    ImportService importService = new ImportService();
                    PresentationStateService psService = new PresentationStateService();

                    if (isImportImage)
                    {
                        #region Step 1: Call ImportService.ImportObject to import an image and create a PS
                        CheckPoint cp_Import = new CheckPoint("Import Image", "Call ImportService.ImportObject to import an image");
                        r.CheckPoints.Add(cp_Import);

                        XMLResult rt_Import = importService.importObject(p_Import_patientId, null, p_Import_objectFileFullPath, null, true, "FALSE");
                        if (rt_Import.IsErrorOccured)
                        {
                            cp_Import.Result = TestResult.Fail;
                            cp_Import.Outputs.AddParameter("import", "Import image returns error", rt_Import.Message);

                            SaveRound(r);
                            continue; // Error happens, end current Test Set
                        }
                        else
                        {
                            cp_Import.Result = TestResult.Pass;
                            cp_Import.Outputs.AddParameter("import", "Import image returns success as expected", rt_Import.Message);

                            imageID = rt_Import.MultiResults[0].Parameters[0].ParameterValue; // This one is the ImageID
                            psID = rt_Import.MultiResults[1].Parameters[0].ParameterValue; // This one is the PS ID
                        }
                        #endregion
                    }

                    #region Step 2: Call PresentationStateService.SetPresentationStateInfo to set the PSInfo for the image
                    CheckPoint cp_SetPresentationStateInfo = new CheckPoint("Set PSInfo", "Call PresentationStateService.SetPresentationStateInfo to set ps info");
                    r.CheckPoints.Add(cp_SetPresentationStateInfo);

                    XMLResult rt_SetPresentationStateInfo = psService.setPresentationStateInfo(p_setPresentationStateInfo, psID);
                    if (ep_isSetPSInfoReturnOK) // Expect the call return OK
                    {
                        if (rt_SetPresentationStateInfo.IsErrorOccured)
                        {
                            cp_SetPresentationStateInfo.Result = TestResult.Fail;
                            cp_SetPresentationStateInfo.Outputs.AddParameter("state", "Set PresentationStateInfo returns error", rt_SetPresentationStateInfo.Message);

                            SaveRound(r);
                            continue; // Error happens, end current Test Set
                        }
                        else
                        {
                            cp_SetPresentationStateInfo.Result = TestResult.Pass;
                            cp_SetPresentationStateInfo.Outputs.AddParameter("state", "Set PresentationStateInfo returns success as expected", rt_SetPresentationStateInfo.Message);

                            #region Step 3: Call PresentationStateService.GetPresentationStateInfo to get the PSInfo for the image
                            CheckPoint cp_GetPresentationStateInfo = new CheckPoint("Get PSInfo", "Call PresentationStateService.GetPresentationStateInfo and check the return state");
                            r.CheckPoints.Add(cp_GetPresentationStateInfo);

                            XMLParameterCollection p_GetPresentationStateInfo = new XMLParameterCollection();
                            XMLParameter p_GetPSInfo_ID = new XMLParameter("presentationstate");
                            p_GetPSInfo_ID.AddParameter("internal_id", psID); // Add current psID as the input param
                            XMLParameter p_GetPSInfo_Preferences = new XMLParameter("preferences");
                            p_GetPresentationStateInfo.Add(p_GetPSInfo_ID);
                            p_GetPresentationStateInfo.Add(p_GetPSInfo_Preferences);

                            XMLResult rt_GetPresentationStateInfo = psService.getPresentationStateInfo(p_GetPresentationStateInfo);

                            if (rt_GetPresentationStateInfo.IsErrorOccured)
                            {
                                cp_GetPresentationStateInfo.Result = TestResult.Fail;
                                cp_GetPresentationStateInfo.Outputs.AddParameter("state", "Get PSInfo returns error", rt_GetPresentationStateInfo.Message);

                                SaveRound(r);
                                continue; // Error happens, end current Test Get
                            }
                            else
                            {
                                cp_GetPresentationStateInfo.Result = TestResult.Pass;
                                cp_GetPresentationStateInfo.Outputs.AddParameter("state", "Get PSInfo returns succeed", rt_GetPresentationStateInfo.Message);

                                // Check the return value is correct
                                #region Step 4: Check the values in PresentationStateService.getPresentationStateInfo return are correct
                                CheckPoint cp_getPSInfoReturnValues = new CheckPoint("Get PSInfo", "Check the values in PresentationStateService.GetPresentationStateInfo return");
                                r.CheckPoints.Add(cp_getPSInfoReturnValues);

                                // Add two check values dynamically
                                ep_getPresentationStateInfo.AddParameter("internal_id", psID);
                                ep_getPresentationStateInfo.AddParameter("image_internal_id", imageID);

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

                                    int i = 0;
                                    for (i = 0; i < rt_GetPresentationStateInfo.DicomArrayResult.Parameters.Count; i++)
                                    {
                                        if (psNode.ParameterName == rt_GetPresentationStateInfo.DicomArrayResult.Parameters[i].ParameterName)
                                        {
                                            isKeyShow = true;
                                            isValueEqual = string.Equals(psNode.ParameterValue, rt_GetPresentationStateInfo.DicomArrayResult.Parameters[i].ParameterValue.Replace("\r", "").Replace("\n", ""));
                                            break; // Find the node, 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
                                    {
                                        cp_getPSInfoReturnValues.Result = TestResult.Fail;

                                        if (isKeyShow)
                                        {
                                            System.Diagnostics.Debug.Print("The return value in getPresentationStateInfo does not match the expected.");
                                            cp_getPSInfoReturnValues.Outputs.AddParameter("PSInfo Info", "Check the values in PresentationStateService.getPresentationStateInfo return", "The value does not match the expected for node: " + psNode.ParameterName + ". Expect: " + psNode.ParameterValue + ". Actually: " + rt_GetPresentationStateInfo.MultiResults[0].Parameters[i].ParameterValue);
                                        }
                                        else
                                        {
                                            System.Diagnostics.Debug.Print("The return value in getPresentationStateInfo does not contain the node: " + psNode.ParameterName);
                                            cp_getPSInfoReturnValues.Outputs.AddParameter("PSInfo Info", "Check the values in PresentationStateService.getPresentationStateInfo return", "The return value does not contain the node: " + psNode.ParameterName);
                                        }

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

                                if (isValueEqual)
                                {
                                    cp_getPSInfoReturnValues.Result = TestResult.Pass;

                                    System.Diagnostics.Debug.Print("The return values in getPresentationStateInfoInfo all match the expected.");
                                    cp_getPSInfoReturnValues.Outputs.AddParameter("PSInfo Info", "Check the values in PresentationStateService.getPresentationStateInfoInfo return", "The return values all match the expected");
                                }
                                #endregion
                            }
                            #endregion
                        }
                    }
                    else // Expect the call return error
                    {
                        if (rt_SetPresentationStateInfo.IsErrorOccured) // There is error
                        {
                            if (rt_SetPresentationStateInfo.Message.ToLower().Contains(ep_SetPSInfoReturnMessage.ToLower()))
                            {
                                cp_SetPresentationStateInfo.Result = TestResult.Pass;
                                cp_SetPresentationStateInfo.Outputs.AddParameter("state", "Set PresentationStateInfo returns error as expected", rt_SetPresentationStateInfo.Message);
                            }
                            else
                            {
                                cp_SetPresentationStateInfo.Result = TestResult.Fail;
                                cp_SetPresentationStateInfo.Outputs.AddParameter("state", "Set PresentationStateInfo returns error message not match the expected. ", "Expect: " + ep_SetPSInfoReturnMessage + "; Actually returns: " + rt_SetPresentationStateInfo.Message);

                                SaveRound(r);
                                continue; // Error happens, end current Test Get
                            }
                        }
                        else // There is no error
                        {
                            cp_SetPresentationStateInfo.Result = TestResult.Fail;
                            cp_SetPresentationStateInfo.Outputs.AddParameter("state", "Set PS not returns error as expected. ", "Actually returns: " + rt_SetPresentationStateInfo.Message);

                            SaveRound(r);
                            continue; // Error happens, end current Test Get
                        }
                    }
                    #endregion

                    if (isImportImage)
                    {
                        #region Step 5: Call ImageService.deleteImage to delete the created image
                        ImageService imageService = new ImageService();
                        CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image");
                        r.CheckPoints.Add(cp_DeleteImage);

                        XMLResult rt_DeleteImage = imageService.deleteImage(imageID, new XMLParameter("preferences"));
                        if (rt_DeleteImage.IsErrorOccured)
                        {
                            cp_DeleteImage.Result = TestResult.Fail;
                            cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns error", rt_DeleteImage.Message);

                            SaveRound(r);
                            continue; // End current test set
                        }
                        else
                        {
                            cp_DeleteImage.Result = TestResult.Pass;
                            cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns success", rt_DeleteImage.Message);
                        }
                        #endregion
                    }
                    SaveRound(r);

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

            Output();
        }
Exemple #58
0
 public XMLResult createPresentationState(string imageInternalID, XMLParameter presentationState)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("createPresentationState", new object[] { imageInternalID, presentationState.GenerateXML() }));
     return(this.lastResult);
 }
        //Case 1566: EK_HI00159159_Create Presentation State
        public void Run_PS_CreatePS_Case1566()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Test PresentationState Service: createPresentationState");

                try
                {
                    #region Parameter initialize
                    string imageInternalID = string.Empty;
                    string currentPSID = string.Empty;
                    string patientInternalId = string.Empty;
                    string objectFileFullPath = string.Empty;

                    XMLParameter p_CreatePresentationState = new XMLParameter("presentationstate");

                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "importImage")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "patient_internal_id")
                            {
                                patientInternalId = ids.InputParameters.GetParameter(i).Value;
                            }
                            else if (ids.InputParameters.GetParameter(i).Key == "objectFileFullPath")
                            {
                                objectFileFullPath = ids.InputParameters.GetParameter(i).Value;
                            }
                        }
                        else if (ids.InputParameters.GetParameter(i).Step == "createPresentationState")
                        {
                            p_CreatePresentationState.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        }
                    }

                    bool ep_isCurrent = false;
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Key == "isCurrent")
                        {
                            ep_isCurrent = ids.ExpectedValues.GetParameter(i).Value.Equals("true");
                        }
                    }
                    #endregion

                    ImageService imageService = new ImageService();
                    ImportService importService = new ImportService();
                    PresentationStateService psService = new PresentationStateService();

                    #region Step 1: Call ImportService.importObject to import a image
                    CheckPoint cp_ImportImage = new CheckPoint("Import Image", "Call ImportService.importObject to import a image");
                    r.CheckPoints.Add(cp_ImportImage);

                    XMLResult rt_ImportImage = importService.importObject(patientInternalId, null, objectFileFullPath, null, true, "false");
                    if (rt_ImportImage.IsErrorOccured)
                    {
                        cp_ImportImage.Result = TestResult.Fail;
                        cp_ImportImage.Outputs.AddParameter("Import", "Import image returns error", rt_ImportImage.Message);

                        SaveRound(r);
                        continue; // There is error when create image, end current run
                    }
                    else
                    {
                        cp_ImportImage.Result = TestResult.Pass;
                        cp_ImportImage.Outputs.AddParameter("Import", "Import image returns success", rt_ImportImage.Message);
                        imageInternalID = rt_ImportImage.MultiResults[0].Parameters[0].ParameterValue;
                        currentPSID = rt_ImportImage.MultiResults[1].Parameters[0].ParameterValue;
                    }
                    #endregion

                    #region Step 2: Call PresentationStateService.CreatePresentationState to create a PS for the image
                    string returnPSID = string.Empty;
                    CheckPoint cp_CreatePresentationState = new CheckPoint("Create PS", "Call PresentationStateService.CreatePresentationState to create a new ps");
                    r.CheckPoints.Add(cp_CreatePresentationState);

                    XMLResult rt_CreatePresentationState = psService.createPresentationState(imageInternalID, p_CreatePresentationState);
                    returnPSID = rt_CreatePresentationState.SingleResult;

                    if (rt_CreatePresentationState.IsErrorOccured)
                    {
                        cp_CreatePresentationState.Result = TestResult.Fail;
                        cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns error", rt_CreatePresentationState.Message);
                    }
                    else
                    {
                        cp_CreatePresentationState.Result = TestResult.Pass;
                        cp_CreatePresentationState.Outputs.AddParameter("create", "Create PS returns success", rt_CreatePresentationState.Message);

                        CheckPoint cp_PresentationStateID = new CheckPoint("Check PS ID", "Check the retrun PS ID in create PS return");
                        r.CheckPoints.Add(cp_PresentationStateID);

                        if (currentPSID == returnPSID) // Return the old current PS ID, defect EK_HI00159159
                        {
                            cp_PresentationStateID.Result = TestResult.Fail;
                            cp_PresentationStateID.Outputs.AddParameter("Check PS ID", "Create PS returns error", "The return ID is not new as expected after call createPS");
                        }
                        else  //Actually return a new PS ID
                        {
                            //Get new current PS ID
                            XMLParameter pListPS = new XMLParameter("filter");
                            pListPS.AddParameter("current", "true");
                            currentPSID = imageService.listPresentationState(pListPS, imageInternalID).SingleResult;

                            if (ep_isCurrent == (currentPSID == returnPSID))
                            {
                                cp_PresentationStateID.Result = TestResult.Pass;
                                cp_PresentationStateID.Outputs.AddParameter("Check PS ID", "Create PS returns error", "The PS ID is correct after call createPS");
                            }
                            else
                            {
                                cp_PresentationStateID.Result = TestResult.Fail;
                                cp_PresentationStateID.Outputs.AddParameter("Check PS ID", "Create PS returns error", "The PS ID is not correct after call createPS");
                            }
                        }
                    }
                    #endregion

                    #region Step 3: Call ImageService.deleteImage to delete the created image
                    CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image");
                    r.CheckPoints.Add(cp_DeleteImage);

                    XMLResult rt_DeleteImage = imageService.deleteImage(imageInternalID, new XMLParameter("preferences"));
                    if (rt_DeleteImage.IsErrorOccured)
                    {
                        cp_DeleteImage.Result = TestResult.Fail;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns error", rt_DeleteImage.Message);
                    }
                    else
                    {
                        cp_DeleteImage.Result = TestResult.Pass;
                        cp_DeleteImage.Outputs.AddParameter("delete image", "Delete image returns success", rt_DeleteImage.Message);
                    }
                    #endregion

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

            Output();
        }
Exemple #60
0
 public XMLResult setPresentationStateInfo(XMLParameter indexInfo, string presentationStateInternalID)
 {
     this.lastResult = new XMLResult(this.InvokeMethod("setPresentationStateInfo", new object[] { indexInfo.GenerateXML(), presentationStateInternalID }));
     return(this.lastResult);
 }