public void Run_Acquisition_New_Ceph_4_Case1672()
        {
            int runCount = 0;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                string acquireType = string.Empty;
                Round r = this.NewRound(runCount.ToString(), "Acquisition");
                ApplicationService apps = new ApplicationService();
                //start 2D simulator and register 2D simulator to CSDM with same port number
                Start2DSimulator s2d = new Start2DSimulator(10000);
                System.Threading.Thread.Sleep(20);
                apps.registerApplication("2DViewer", "localhost", 10000, true);

                //get acquire information and expect information
                XMLParameter acq = new XMLParameter("acq_info");
                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);
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "acquireType")
                    {
                        acquireType = ids.InputParameters.GetParameter(i).Key;
                    }
                }
                Dictionary<string, string> expectVal = new Dictionary<string, string>();
                for (int j = 0; j < ids.ExpectedValues.Count; j++)
                {
                    if (ids.InputParameters.GetParameter(j).Step == "acquire")
                    {
                        expectVal.Add(ids.ExpectedValues.GetParameter(j).Key, ids.ExpectedValues.GetParameter(j).Value);
                    }
                }

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

                string stopMessageType = "teststop";
                string stopMessageContent = "teststop";

                string hostadd = PAS.AutoTest.TestUtility.Utility.GetCSDMConfig(PAS.AutoTest.TestUtility.CSDMConfigSection.remote, "host");
                string portnoti = PAS.AutoTest.TestUtility.Utility.GetCSDMConfig(PAS.AutoTest.TestUtility.CSDMConfigSection.remote, "notificationPort");
                NotificationSim.ReceiveNotification rn = new NotificationSim.ReceiveNotification(hostadd, int.Parse(portnoti));

                System.Collections.Generic.List<string> rms = new System.Collections.Generic.List<string>();
                rms.Add("topic.acquisitionCompleted");
                rn.startListon(rms, stopMessageType, stopMessageContent);

                AcquisitionService acqs = new AcquisitionService();
                XMLResult rslAcqRVG = acqs.startAcquisition(acq);
                string acq_session_id = "";

                System.Threading.Thread.Sleep(1000);
                switch (acquireType)
                {
                    case "PANO":
                        System.Diagnostics.Debug.Print("PANO Acquire");
                        //Utility.AcqPanoImage(300);
                        System.Threading.Thread tx = new System.Threading.Thread(Utility.AcquirePanoOne);
                        tx.Start();
                        break;
                    case "CEPH":
                        System.Diagnostics.Debug.Print("CEPH Acquire");
                        //Utility.AcqCephImage(50);
                        System.Threading.Thread tx1 = new System.Threading.Thread(Utility.AcquireCephOne);
                        tx1.Start();
                        break;
                    default:
                        System.Diagnostics.Debug.Print("NOT FMS/PANO/CEPH/CR Acquire");
                        break;
                }
                if (rslAcqRVG.IsErrorOccured)
                {
                    System.Diagnostics.Debug.Print("Acquire fail:");
                    pAcquire.Result = TestResult.Fail;
                    pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message);
                    continue;
                }
                else
                {
                    acq_session_id = rslAcqRVG.SingleResult;
                    pAcquire.Result = TestResult.Pass;
                    pAcquire.Outputs.AddParameter("Acquire image success", "startAcquisition", rslAcqRVG.ResultContent);

                    //start an advanced simulator to receive the specified command
                    int port = 10000;
                    string sRet = "";
                    TwoDSim.AdvanceSimulator asi = new TwoDSim.AdvanceSimulator(port);
                    asi.StartSimulater("0,OK;open_acquired_objects");
                    sRet = asi.StopSimulator(120000);

                    CheckPoint pCheckMessage = new CheckPoint("Check Command", "Acquisition SOCKET Message");
                    r.CheckPoints.Add(pCheckMessage);
                    if (sRet == "")
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("NO COMMAND", "Check Command", "TIMEOUT: The socket message doesn't received");
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        pCheckMessage.Outputs.AddParameter("open_acquired_objects COMMAND parameter", "Record Command", sRet);
                    }

                    ParseMessageContent cn = new ParseMessageContent(sRet);

                    //get patient internal id from command message
                    string patient_uid = cn.getValueFromKey("-patient_internal_id");
                    bool gotPatientId = false;
                    foreach (KeyValuePair<string, string> kvp in expectVal)
                    {
                        if (kvp.Key == "patient_internal_id" && kvp.Value == patient_uid)
                        {
                            gotPatientId = true;
                        }
                    }
                    if (!gotPatientId)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Patient ID Check ERROR", "Check Command", "The socket message content with WRONG patient ID");
                        SaveRound(r);
                        continue;
                    }

                    string image_internal_id_from_acqResult = "";
                    string ps_internal_id_from_acqResult = "";
                    string image_internal_id_from_mapfile = "";
                    string ps_internal_id_from_mapfile = "";

                    //get acquisition session id from command message
                    string session_uid_from_command = cn.getValueFromKey("-session_id");
                    if (acq_session_id != session_uid_from_command)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Session ID Check ERROR", "Check Command", "The session id from command not equals the id from startAcquisition!");
                        SaveRound(r);
                        continue;
                    }
                    int timeout = 0;
                    do
                    {
                        XMLResult rslgetAcqResult = acqs.getAcquisitionResult(session_uid_from_command);
                        //timeout added
                        if (!rslgetAcqResult.IsErrorOccured && rslgetAcqResult.Code == 0)
                        {
                            pCheckMessage.Outputs.AddParameter("Show the content after getAcquisitionResult", "Output getAcquisitionResult", rslgetAcqResult.ResultContent);
                            ParseXMLContent rslacqResult = new ParseXMLContent(rslgetAcqResult.ResultContent);
                            image_internal_id_from_acqResult = rslacqResult.getStringWithPathAndType("trophy/object_info", "image", "value");
                            ps_internal_id_from_acqResult = rslacqResult.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                            break;
                        }
                        timeout++;
                        System.Threading.Thread.Sleep(1000);
                    } while (timeout < 120);
                    if (timeout >= 120)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Try too many times", "Check getAcquisitionResult", "TIMEOUT of getAcquisitionResult");
                        break;
                    }

                    //parser the mapping xml content from command message
                    string mapping_xml = cn.getValueFromKey("-mapping_xml");
                    string mapping_content = base64tools.DecodeString4base(mapping_xml);
                    pCheckMessage.Outputs.AddParameter("Show the decode mapping file content", "Output mappingfile", mapping_content);
                    string target_path = "";

                    if (mapping_content != null)
                    {
                        ParseXMLContent pc = new ParseXMLContent(mapping_content);
                        pc.getValueFromPath("path_mapping/instance");
                        string type = pc.getValueByKey("type");

                        int indexKey = type.IndexOf(";");
                        if (indexKey != -1)
                            type = type.Substring(0, indexKey);

                        bool gotType = false;
                        foreach (KeyValuePair<string, string> kvp in expectVal)
                        {
                            if (kvp.Key == "type" && kvp.Value == type)
                            {
                                gotType = true;
                            }
                        }
                        if (!gotType)
                        {
                            pCheckMessage.Result = TestResult.Fail;
                            pCheckMessage.Outputs.AddParameter("Type Check ERROR", "Check Command ", "The socket message content with WRONG type");
                            SaveRound(r);
                            continue;
                        }

                        string original_path = pc.getValueByKey("original_path");

                        //check the acquired image has been put into correct position.
                        target_path = pc.getValueByKey("target_path");
                        int indexPath = target_path.IndexOf(";");
                        if (indexPath != -1)
                            target_path = target_path.Substring(0, indexPath);
                        //now the Processing data file not provide correct after send command
                        bool dicomfileexist = Utility.isFileExisted(target_path);
                        if (!dicomfileexist)
                        {
                            pCheckMessage.Result = TestResult.Fail;
                            pCheckMessage.Outputs.AddParameter("Dicom File Check ERROR", "Check Command", "The acquired image not in cache place");
                            SaveRound(r);
                            continue;
                        }

                        image_internal_id_from_mapfile = pc.getWithPathAndTypeFromMappingFile("path_mapping", "Image", "instance_internal_id");
                        ps_internal_id_from_mapfile = pc.getWithPathAndTypeFromMappingFile("path_mapping", "Image", "ps_internal_id");
                    }
                    if (image_internal_id_from_acqResult != image_internal_id_from_mapfile)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "The image id from command not equals the id from getAcquisitionResult!");
                        SaveRound(r);
                        continue;
                    }
                    if (ps_internal_id_from_acqResult != ps_internal_id_from_mapfile)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "The presentation id from command not equals the id from getAcquisitionResult!");
                        SaveRound(r);
                        continue;
                    }

                    //parser the trophy xml content from command message
                    string acq_out_xml = cn.getValueFromKey("-acq_out_xml");
                    string acq_out = base64tools.DecodeString4base(acq_out_xml);
                    pCheckMessage.Outputs.AddParameter("XML From SDK", "Output acquisition SDK content", acq_out);
                    pCheckMessage.Result = TestResult.Pass;
                    pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "All ID is matched");

                    CheckPoint pCheckGetImage = new CheckPoint("Check NOTIFICATION", "Acquisition complete Message");
                    r.CheckPoints.Add(pCheckGetImage);
                    apps.sendGenericNotification(stopMessageType, stopMessageContent);
                    System.Threading.Thread.Sleep(1000);

                    //check getImageInfo
                    int getn = rn.getNotificationNumber();
                    if (getn == 2)
                    {

                        XMLParameter getImage = new XMLParameter("image");
                        int indexImage = image_internal_id_from_acqResult.IndexOf(";");
                        if (indexImage != -1)
                            image_internal_id_from_acqResult = image_internal_id_from_acqResult.Substring(0, indexImage);
                        getImage.AddParameter("internal_id", image_internal_id_from_acqResult);
                        ImageService imagesrv = new ImageService();
                        XMLResult getImageRsl = imagesrv.getImageInfo(getImage);
                        //match items
                        pCheckGetImage.Outputs.AddParameter("Get Image Info result", "Get Return XML", getImageRsl.ResultContent);
                        int matchValueCount = 0;
                        for (int i = 0; i < getImageRsl.DicomArrayResult.Length; i++)
                        {
                            if (getImageRsl.DicomArrayResult.Parameters[i].ParameterName == "internal_id"
                                && getImageRsl.DicomArrayResult.Parameters[i].ParameterValue == image_internal_id_from_acqResult)
                            {
                                matchValueCount++;
                            }

                            if (getImageRsl.DicomArrayResult.Parameters[i].ParameterName == "patient_internal_id"
                                && getImageRsl.DicomArrayResult.Parameters[i].ParameterValue == patient_uid)
                            {
                                matchValueCount++;
                            }
                            target_path = target_path.Replace('\\', '/');
                            if (getImageRsl.DicomArrayResult.Parameters[i].ParameterName == "path"
                                && getImageRsl.DicomArrayResult.Parameters[i].ParameterValue == target_path)
                            {
                                matchValueCount++;
                            }
                        }
                        if (matchValueCount == 3)
                        {
                            pCheckGetImage.Result = TestResult.Pass;
                            pCheckGetImage.Outputs.AddParameter("Get Image Info result", "Check Return XML", "All ID is matched");
                        }
                        else
                        {
                            pCheckGetImage.Result = TestResult.Fail;
                            pCheckGetImage.Outputs.AddParameter("Get Image Info result", "Check Return XML", "Some ID is not matched");
                        }

                    }
                    else
                    {
                        pCheckGetImage.Result = TestResult.Fail;
                        pCheckGetImage.Outputs.AddParameter("Notification not received", "Check Return", "No acquisition complete Message be received");
                    }

                }
                SaveRound(r);
            }
            Output();
        }
        public void Run_Acquisition_New_FMS_2_Case1670()
        {
            int runCount = 0;
            string acquireType = string.Empty;
            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "Acquisition");

                ApplicationService apps = new ApplicationService();
                //start 2D simulator and register 2D simulator to CSDM with same port number
                Start2DSimulator s2d = new Start2DSimulator(10000);
                System.Threading.Thread.Sleep(20);
                apps.registerApplication("2DViewer", "localhost", 10000, true);

                //get acquire information and expect information
                XMLParameter acq = new XMLParameter("acq_info");
                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);
                    }
                    if (ids.InputParameters.GetParameter(i).Step == "acquireType")
                    {
                        acquireType = ids.InputParameters.GetParameter(i).Key;
                    }
                }
                Dictionary<string, string> expectVal = new Dictionary<string, string>();
                for (int j = 0; j < ids.ExpectedValues.Count; j++)
                {
                    if (ids.InputParameters.GetParameter(j).Step == "acquire")
                    {
                        expectVal.Add(ids.ExpectedValues.GetParameter(j).Key, ids.ExpectedValues.GetParameter(j).Value);
                    }
                }

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

                //start stomp message listener
                string stopMessageType = "teststop";
                string stopMessageContent = "teststop";

                string hostadd = PAS.AutoTest.TestUtility.Utility.GetCSDMConfig(PAS.AutoTest.TestUtility.CSDMConfigSection.remote, "host");
                string portnoti = PAS.AutoTest.TestUtility.Utility.GetCSDMConfig(PAS.AutoTest.TestUtility.CSDMConfigSection.remote, "notificationPort");
                NotificationSim.ReceiveNotification rn = new NotificationSim.ReceiveNotification(hostadd, int.Parse(portnoti));

                System.Collections.Generic.List<string> rms = new System.Collections.Generic.List<string>();
                rms.Add("topic.acquisitionCompleted");
                rn.startListon(rms, stopMessageType, stopMessageContent);

                AcquisitionService acqs = new AcquisitionService();
                XMLResult rslAcqRVG = acqs.startAcquisition(acq);

                switch (acquireType)
                {
                    case "FMS":
                        System.Diagnostics.Debug.Print("FMS Acquire");
                        //Utility.AcqFMS(40, 300);
                        System.Threading.Thread tx = new System.Threading.Thread(Utility.AcquireFMSOne);
                        tx.Start();
                        break;
                    default:
                        System.Diagnostics.Debug.Print("NOT FMS/PANO/CEPH/CR Acquire");
                        break;
                }

                string acq_session_id = "";
                //System.Threading.Thread.Sleep(50);
                if (rslAcqRVG.IsErrorOccured)
                {
                    System.Diagnostics.Debug.Print("Acquire fail:");
                    pAcquire.Result = TestResult.Fail;
                    pAcquire.Outputs.AddParameter("Acquire image error", "startAcquisition", rslAcqRVG.Message);
                    continue;
                }
                else
                {
                    acq_session_id = rslAcqRVG.SingleResult;
                    pAcquire.Result = TestResult.Pass;
                    pAcquire.Outputs.AddParameter("Acquire image success", "startAcquisition", rslAcqRVG.ResultContent);

                    //start an advanced simulator to receive the specified command
                    int port = 10000;
                    string sRet = "";
                    TwoDSim.AdvanceSimulator asi = new TwoDSim.AdvanceSimulator(port);
                    asi.StartSimulater("0,OK;open_acquired_objects");
                    sRet = asi.StopSimulator(120000);

                    CheckPoint pCheckMessage = new CheckPoint("Check Command", "Acquisition SOCKET Message");
                    r.CheckPoints.Add(pCheckMessage);
                    if (sRet == "")
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("NO COMMAND ERROR", "Check Command", "TIMEOUT: The socket message doesn't received");
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        pCheckMessage.Outputs.AddParameter("open_acquired_objects COMMAND parameter", "Record Command", sRet);
                    }

                    ParseMessageContent cn = new ParseMessageContent(sRet);

                    //get patient internal id from command message
                    string patient_uid = cn.getValueFromKey("-patient_internal_id");
                    bool gotPatientId = false;
                    foreach (KeyValuePair<string, string> kvp in expectVal)
                    {
                        if (kvp.Key == "patient_internal_id" && kvp.Value == patient_uid)
                        {
                            gotPatientId = true;
                        }
                    }
                    if (!gotPatientId)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Patient ID Check ERROR", "Check Command", "The socket message content with WRONG patient ID");
                        SaveRound(r);
                        continue;
                    }

                    string fms_internal_id_from_acqResult = "";
                    string fms_internal_id_from_mapfile = "";
                    string image_internal_id_from_acqResult = "";
                    string ps_internal_id_from_acqResult = "";
                    string image_internal_id_from_mapfile = "";
                    string ps_internal_id_from_mapfile = "";

                    //get acquisition session id from command message
                    string session_uid_from_command = cn.getValueFromKey("-session_id");
                    if (acq_session_id != session_uid_from_command)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Session ID Check EROR", "Check Command", "The session id from command not equals the id from startAcquisition!");
                        SaveRound(r);
                        continue;
                    }

                    int timeout = 0;
                    do
                    {
                        XMLResult rslgetAcqResult = acqs.getAcquisitionResult(session_uid_from_command);

                        if (!rslgetAcqResult.IsErrorOccured && rslgetAcqResult.Code == 0)
                        {
                            pCheckMessage.Outputs.AddParameter("Show the content after getAcquisitionResult", "Output getAcquisitionResult", rslgetAcqResult.ResultContent);
                            ParseXMLContent rslForFMS = new ParseXMLContent(rslgetAcqResult.ResultContent);
                            fms_internal_id_from_acqResult = rslForFMS.getStringWithPathAndType("trophy/object_info", "fms", "value");
                            image_internal_id_from_acqResult = rslForFMS.getStringWithPathAndType("trophy/object_info", "image", "value");
                            ps_internal_id_from_acqResult = rslForFMS.getStringWithPathAndType("trophy/object_info", "presentation_state", "value");
                            break;
                        }
                        timeout++;
                        System.Threading.Thread.Sleep(1000);
                    } while (timeout < 300);
                    if (timeout >= 300)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Try too many times", "Check getAcquisitionResult", "TIMEOUT of getAcquisitionResult");
                        break;
                    }

                    string fmsfilepath = "";
                    string original_path = "";
                    //parser the mapping xml content from command message
                    string mapping_xml = cn.getValueFromKey("-mapping_xml");
                    string mapping_content = base64tools.DecodeString4base(mapping_xml);
                    pCheckMessage.Outputs.AddParameter("Show the decode mapping file content", "Output mappingfile", mapping_content);
                    string target_path = "";
                    string keep_target_path = "";
                    if (mapping_content != null)
                    {
                        ParseXMLContent pc = new ParseXMLContent(mapping_content);
                        pc.getValueFromPath("path_mapping/instance");
                        string type = pc.getValueByKey("type");
                        bool gotType = false;
                        foreach (KeyValuePair<string, string> kvp in expectVal)
                        {
                            if (kvp.Key == "type" && type.Contains(kvp.Value))
                            {
                                gotType = true;
                            }
                        }
                        if (!gotType)
                        {
                            pCheckMessage.Result = TestResult.Fail;
                            pCheckMessage.Outputs.AddParameter("Type Check ERROR", "Check Command", "The socket message content with WRONG type");
                            SaveRound(r);
                            continue;
                        }

                        original_path = pc.getValueByKey("original_path");

                        //check the acquired image has been put into correct position.
                        target_path = pc.getValueByKey("target_path");
                        keep_target_path = target_path;
                        int needCheckFile = 0;
                        int checkedFile = 0;
                        do
                        {
                            string sub_target_path = target_path;
                            int indexKey = sub_target_path.IndexOf(";");
                            if (indexKey != -1)
                            {
                                sub_target_path = sub_target_path.Substring(0, indexKey);
                                target_path = target_path.Substring(indexKey + 1);

                                //temp in here to skip the processing file check.
                                if (sub_target_path.Contains(".xml"))
                                {
                                    continue;
                                }

                                needCheckFile++;
                                bool dicomfileexist = Utility.isFileExisted(sub_target_path);
                                if (sub_target_path.Contains(".fms"))
                                    fmsfilepath = sub_target_path;

                                if (!dicomfileexist)
                                {
                                    pCheckMessage.Result = TestResult.Fail;
                                    pCheckMessage.Outputs.AddParameter("Dicom File {" + sub_target_path + "} Check ERROR", "Check Command", "The acquired image not in cache place");
                                    SaveRound(r);
                                    continue;
                                }
                                checkedFile++;
                            }
                        } while (target_path != "");

                        if (needCheckFile != checkedFile)
                        {
                            pCheckMessage.Result = TestResult.Fail;
                            pCheckMessage.Outputs.AddParameter("Files Check ERROR", "Check Command", "No all files contained in Message are exist");
                            SaveRound(r);
                            continue;
                        }

                        //get all image uid from mapping file
                        image_internal_id_from_mapfile = pc.getWithPathAndTypeFromMappingFile("path_mapping", "Image", "instance_internal_id");
                        //get all ps uid from mapping file
                        ps_internal_id_from_mapfile = pc.getWithPathAndTypeFromMappingFile("path_mapping", "Image", "ps_internal_id");
                        //get FMS uid from mapping file
                        fms_internal_id_from_mapfile = pc.getWithPathAndTypeFromMappingFile("path_mapping", "FMS", "instance_internal_id");

                        string processdatafilecontent = pc.getWithPathAndTypeFromMappingFile("path_mapping", "ProcessingDataFile", "content");
                        int countForProcessing = 0;
                        do
                        {
                            string sub_processdatafilecontent = processdatafilecontent;
                            int indexKey3 = sub_processdatafilecontent.IndexOf(";");
                            if (indexKey3 != -1)
                            {

                                sub_processdatafilecontent = sub_processdatafilecontent.Substring(0, indexKey3);
                                processdatafilecontent = processdatafilecontent.Substring(indexKey3 + 1);
                                if (sub_processdatafilecontent != "")
                                {
                                    countForProcessing++;
                                    string processingXMLcontent = base64tools.DecodeString4base(sub_processdatafilecontent);
                                    pCheckMessage.Outputs.AddParameter("Processing Data File from SDK", "Processing Content " + countForProcessing, processingXMLcontent);
                                }
                            }
                        } while (processdatafilecontent != "");

                    }
                    if (image_internal_id_from_acqResult != image_internal_id_from_mapfile)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "The image id from command not equals the id from getAcquisitionResult!");
                        SaveRound(r);
                        continue;
                    }
                    if (ps_internal_id_from_acqResult != ps_internal_id_from_mapfile)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "The presentation id from command not equals the id from getAcquisitionResult!");
                        SaveRound(r);
                        continue;
                    }
                    if (fms_internal_id_from_acqResult != fms_internal_id_from_mapfile)
                    {
                        pCheckMessage.Result = TestResult.Fail;
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "The FMS id from command not equals the id from getAcquisitionResult!");
                        SaveRound(r);
                        continue;
                    }

                    //parser the trophy xml content from command message
                    string acq_out_xml = cn.getValueFromKey("-acq_out_xml");
                    string acq_out = base64tools.DecodeString4base(acq_out_xml);
                    pCheckMessage.Outputs.AddParameter("XML From SDK", "Check Command", acq_out);

                    //Check the FMS contain the correct image that compare with mapping files
                    ParseXMLContent pc1 = new ParseXMLContent(fmsfilepath, "File");
                    string psIDInFMS = pc1.getStringFromPath("FMS_DATA/ItemData/Identifier");
                    int checkPSIDInResult = 0;
                    int psInFMSContent = 0;
                    do
                    {
                        string sub_psID = psIDInFMS;
                        int indexKey = sub_psID.IndexOf(";");
                        if (indexKey != -1)
                        {
                            psInFMSContent++;
                            sub_psID = sub_psID.Substring(0, indexKey);
                            psIDInFMS = psIDInFMS.Substring(indexKey + 1);
                        }
                        if (ps_internal_id_from_acqResult.Contains(sub_psID))
                        {
                            checkPSIDInResult++;
                        }

                    } while (psIDInFMS != "");
                    if (checkPSIDInResult == psInFMSContent)
                    {
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "All IMAGEs in FMS are matched with mapping file");
                    }
                    else
                    {
                        pCheckMessage.Outputs.AddParameter("Message and Interface result", "Check Command", "NOT All IMAGEs in FMS are matched with mapping file");
                    }
                    //Check the FMS contain the correct image end

                    System.Threading.Thread.Sleep(5000);
                    CheckPoint pCheckGetImage = new CheckPoint("Check NOTIFICATION", "Acquisition complete Message");
                    r.CheckPoints.Add(pCheckGetImage);
                    apps.sendGenericNotification(stopMessageType, stopMessageContent);
                    System.Threading.Thread.Sleep(1000);
                    //check getFMSInfo
                    int getn = rn.getRecievedNumber();
                    if (getn == 2)
                    {
                        FMSService fmss = new FMSService();
                        int indexKey = fms_internal_id_from_mapfile.IndexOf(";");
                        if (indexKey != -1)
                        {
                            fms_internal_id_from_mapfile = fms_internal_id_from_mapfile.Substring(0, indexKey);
                        }

                        //check get FMS description with content
                        XMLResult fmsDesRsl = fmss.getFMSDescription(fms_internal_id_from_mapfile);
                        string psids = "";
                        if (fmsDesRsl.IsErrorOccured || fmsDesRsl.Code != 0)
                        {
                            pCheckGetImage.Result = TestResult.Fail;
                            pCheckGetImage.Outputs.AddParameter("Get FMS Info result", "Get Return XML", fmsDesRsl.ResultContent);
                            continue;
                        }
                        else
                        {
                            ParseXMLContent pc2 = new ParseXMLContent(fmsDesRsl.ResultContent);
                            pc2.getValueFromPath("trophy/presentationstate");
                            psids = pc2.getValueByKey("internal_id");
                        }
                        int checkPSIDInFMSDes = 0;
                        int psInGetFMSDes = 0;
                        do
                        {
                            string sub_psID = psids;
                            int indKey = sub_psID.IndexOf(";");
                            if (indKey != -1)
                            {
                                psInGetFMSDes++;
                                sub_psID = sub_psID.Substring(0, indKey);
                                psids = psids.Substring(indKey + 1);
                            }
                            if (ps_internal_id_from_acqResult.Contains(sub_psID))
                            {
                                checkPSIDInFMSDes++;
                            }

                        } while (psids != "");

                        if (checkPSIDInFMSDes == psInGetFMSDes)
                        {
                            pCheckGetImage.Outputs.AddParameter("Check the presentation ids again with getAcquisitionResult", "Check the presentation ids", "ALL IDs is equal with aspect");
                        }
                        else
                        {
                            pCheckGetImage.Result = TestResult.Fail;
                            pCheckGetImage.Outputs.AddParameter("Check the presentation ids again with getAcquisitionResult", "Check the presentation ids", "Some IDs is not equal with aspect");
                            continue;
                        }

                        //got the first image to check
                        XMLParameter getImage = new XMLParameter("image");
                        int indexImage = image_internal_id_from_acqResult.IndexOf(";");
                        if (indexImage != -1)
                            image_internal_id_from_acqResult = image_internal_id_from_acqResult.Substring(0, indexImage);
                        getImage.AddParameter("internal_id", image_internal_id_from_acqResult);
                        ImageService imagesrv = new ImageService();
                        XMLResult getImageRsl = imagesrv.getImageInfo(getImage);
                        //match items
                        pCheckGetImage.Outputs.AddParameter("Get Image Info result", "Get Return XML", getImageRsl.ResultContent);
                        int matchValueCount = 0;
                        for (int i = 0; i < getImageRsl.DicomArrayResult.Length; i++)
                        {
                            if (getImageRsl.DicomArrayResult.Parameters[i].ParameterName == "internal_id"
                                && getImageRsl.DicomArrayResult.Parameters[i].ParameterValue == image_internal_id_from_acqResult)
                            {
                                matchValueCount++;
                            }

                            if (getImageRsl.DicomArrayResult.Parameters[i].ParameterName == "patient_internal_id"
                                && getImageRsl.DicomArrayResult.Parameters[i].ParameterValue == patient_uid)
                            {
                                matchValueCount++;
                            }
                            keep_target_path = keep_target_path.Replace('\\', '/');
                            if (getImageRsl.DicomArrayResult.Parameters[i].ParameterName == "path"
                                && keep_target_path.Contains(getImageRsl.DicomArrayResult.Parameters[i].ParameterValue))
                            {
                                matchValueCount++;
                            }
                        }
                        if (matchValueCount == 3)
                        {
                            pCheckGetImage.Result = TestResult.Pass;
                            pCheckGetImage.Outputs.AddParameter("Get Image Info result", "Check Return XML", "All ID is matched");
                        }
                        else
                        {
                            pCheckGetImage.Result = TestResult.Fail;
                            pCheckGetImage.Outputs.AddParameter("Get Image Info result", "Check Return XML", "Some ID is not matched");
                        }

                    }
                    else
                    {
                        pCheckGetImage.Result = TestResult.Fail;
                        pCheckGetImage.Outputs.AddParameter("Notification not received", "Check Return", "No acquisition complete Message be received");
                    }

                    pCheckMessage.Result = TestResult.Pass;
                }
                SaveRound(r);
            }
            Output();
        }