//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();
        }
        //Case 926: 1.3.3_WorkFlow_N02_CreateDeleteGet
        public void Run_RadioLogicalLog_WorkFlow_N02_CreateDeleteGet_Case926()
        {
            //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("createRadioLogEntry", "Setup environment of createRadioLogEntry");
                CheckPoint p3 = new CheckPoint("deleteRadioLogEntry", "Test deleteRadioLogEntry");
                CheckPoint p4 = new CheckPoint("getRadioLogEntry", "Test getRadioLogEntry");

                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();
                RadiologService radios = new RadiologService();

                //create input parameters here, it may include XML path type and string type value
                XMLParameter pa1 = new XMLParameter("createPatient");
                XMLParameter pa2 = new XMLParameter("createRadioLogEntry");
                XMLParameter pa3 = new XMLParameter("deleteRadioLogEntry");
                XMLParameter pa4 = new XMLParameter("getRadioLogEntry");

                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 "createRadioLogEntry":
                            pa2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                            break;
                        case "deleteRadioLogEntry":
                            pa3.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                            break;
                        case "getRadioLogEntry":
                            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

                XMLResult step2_result = radios.createRadioLogEntry(pa2);

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

                p2.Result = TestResult.Pass;
                p2.Outputs.AddParameter("createRadioLogEntry", "Success", step2_result.ResultContent);

                //Change input parameter according the output of Step2
                pa3.AddParameter("radioLogEntryInternalId", step2_result.SingleResult);
                pa4.AddParameter("radioLogEntryInternalId", step2_result.SingleResult);

                //Step3 result

                XMLResult step3_result = radios.deleteRadioLogEntry(pa3.GetParameterValueByName("radioLogEntryInternalId"));

                //Log step3 service output
                if (step3_result.IsErrorOccured)
                {
                    p3.Result = TestResult.Fail;
                    p3.Outputs.AddParameter("deleteRadioLogEntry", "Error", step3_result.ResultContent);
                    SaveRound(r);
                    continue;
                }

                p3.Result = TestResult.Pass;
                p3.Outputs.AddParameter("deleteRadioLogEntry", "Success", step3_result.ResultContent);

                //Change input parameter according the output of Step3

                //Step4 result

                XMLResult step4_result = radios.getRadioLogEntry(pa4.GetParameterValueByName("radioLogEntryInternalId"));

                //Log step4 service output

                if (step4_result.Code.ToString() == ids.ExpectedValues.GetParameter("code").Value)
                {
                    p4.Result = TestResult.Pass;
                    p4.Outputs.AddParameter("getRadioLogEntry", "Success", step4_result.ResultContent);
                }
                else
                {
                    p4.Result = TestResult.Fail;
                    p4.Outputs.AddParameter("getRadioLogEntry", "Error", step4_result.ResultContent);
                }

                //Save data for each round
                SaveRound(r);
            }

            //Save service log as xml file
            Output();
        }
        //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();
        }
        //Case 925: 1.3.3_WorkFlow_N01_CreateGet
        public void Run_RadioLogicalLog_WorkFlow_N01_CreateGet_Case925()
        {
            //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("createRadioLogEntry", "Test createRadioLogEntry");
                CheckPoint p4 = new CheckPoint("getRadioLogEntry", "Test getRadioLogEntry");

                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();
                RadiologService radios = new RadiologService();

                //create input parameters here, it may include XML path type and string type value
                XMLParameter pa1 = new XMLParameter("createPatient");
                XMLParameter pa2 = new XMLParameter("importObject");
                XMLParameter pa3 = new XMLParameter("createRadioLogEntry");
                XMLParameter pa4 = new XMLParameter("getRadioLogEntry");

                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;
                        case "createRadioLogEntry":
                            pa3.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                            break;
                        case "getRadioLogEntry":
                            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("patientInternalId", step1_result.SingleResult);
                pa3.AddParameter("patient_internal_id", 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("importObject", "Error", step2_result.ResultContent);
                        SaveRound(r);
                        continue;
                    }

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

                    //Change input parameter according the output of Step2
                    // if step2 is skipped, step3 input has no need parameter of instance_internal_id
                    pa3.AddParameter("instance_internal_id", step2_result.ArrayResult.GetParameterValueByName("internal_id"));
                }
                else
                {
                    p2.Outputs.AddParameter("importObject", "Success", "This step is ignored by case, no run");
                    p2.Result = TestResult.Pass;
                }

                //Step3 result

                XMLResult step3_result = radios.createRadioLogEntry(pa3);

                //Log step3 service output
                if (step3_result.IsErrorOccured)
                {
                    p3.Result = TestResult.Fail;
                    p3.Outputs.AddParameter("createRadioLogEntry", "Error", step3_result.ResultContent);
                    SaveRound(r);
                    continue;
                }

                p3.Result = TestResult.Pass;
                p3.Outputs.AddParameter("createRadioLogEntry", "Success", step3_result.ResultContent);

                //Change input parameter according the output of Step3
                pa4.AddParameter("radioLogEntryInternalId", step3_result.SingleResult);
                //Step4 result

                XMLResult step4_result = radios.getRadioLogEntry(pa4.GetParameterValueByName("radioLogEntryInternalId"));

                //Log step4 service output
                //Compare the input parameters of createRadioLogEntry and output result of getRadioLogEntry
                int compCount = 0;

                for (int index = 0; index < ids.ExpectedValues.Parameters.Count; index++)
                {
                    if (ids.ExpectedValues.Parameters[index].Value == step4_result.ArrayResult.GetParameterValueByName(ids.ExpectedValues.Parameters[index].Key))
                    { compCount++; }
                }

                if (step4_result.IsErrorOccured || compCount != ids.ExpectedValues.Parameters.Count)
                {
                    p4.Result = TestResult.Fail;
                    p4.Outputs.AddParameter("getRadioLogEntry", "Error", step4_result.ResultContent);
                }
                else
                {
                    p4.Result = TestResult.Pass;
                    p4.Outputs.AddParameter("getRadioLogEntry", "Success", step4_result.ResultContent);
                }

                //Save data for each round
                SaveRound(r);
            }

            //Save service log as xml file
            Output();
        }