// 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 1527: 1.1.03.03_List Objects - N1 - ALL public void Run_Patient_ListObjects_Case1527() { int runCount = 0; NewPatientService nps = new NewPatientService(); PatientListObjectsRequestType ploReq = new PatientListObjectsRequestType(); //ploReq.type = PatientListObjectsType.all PatientListObjectsResponseType ploRes = new PatientListObjectsResponseType(); //ploReq.filter = ploFilter; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "ListObject"); CheckPoint pLo = new CheckPoint("List Object", "Test create"); r.CheckPoints.Add(pLo); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "filter") { if (ids.InputParameters.GetParameter(i).Key == "patientUid") { ploReq.patientInternalId = ids.InputParameters.GetParameter(i).Value; } if (ids.InputParameters.GetParameter(i).Key == "type") { switch (ids.InputParameters.GetParameter(i).Value) { case "all": ploReq.type = PatientListObjectsType.all; break; case "fms": ploReq.type = PatientListObjectsType.fms; break; case "presentationstate": ploReq.type = PatientListObjectsType.presentationState; break; case "analysis": ploReq.type = PatientListObjectsType.analysis; break; case "other": ploReq.type = PatientListObjectsType.other; break; case "video": ploReq.type = PatientListObjectsType.video; break; case "colorimage": ploReq.type = PatientListObjectsType.colorImage; break; case "gallery": ploReq.type = PatientListObjectsType.gallery; break; case "volume": ploReq.type = PatientListObjectsType.volume; break; case "analysis3d": ploReq.type = PatientListObjectsType.analysis3D; break; } } if (ids.InputParameters.GetParameter(i).Key == "current" && ids.InputParameters.GetParameter(i).Value == "true") ploReq.current = true; if (ids.InputParameters.GetParameter(i).Key == "current" && ids.InputParameters.GetParameter(i).Value == "false") ploReq.current = false; ploReq.currentSpecified = true; } } ploRes = nps.listObjects(ploReq); //nps.listObjects(ploReq); if (ploRes.status.code == 0) { pLo.Result = TestResult.Pass; pLo.Outputs.AddParameter("List Object Return Pass", "List Object", "The web service return is OK!"); } else { pLo.Result = TestResult.Fail; pLo.Outputs.AddParameter("List Object Return Fail", "List Object", "The web service return is ERROR!"); } string expectString = string.Empty; int matchItem = 0; for (int j = 0; j < ids.ExpectedValues.Count; j++) { if (ids.ExpectedValues.GetParameter(j).Step == "presentationstate") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.presentationStates != null && ploRes.presentationStates.Length > 0) { foreach (PresentationStateType ps in ploRes.presentationStates) { if (ps.uid != expectString) continue; else { matchItem++; break; } } } } if (ids.ExpectedValues.GetParameter(j).Step == "fms") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.fmss != null && ploRes.fmss.Length > 0) { foreach (FmsType fms in ploRes.fmss) { if (fms.uid != expectString) continue; else { matchItem++; break; } } } } if (ids.ExpectedValues.GetParameter(j).Step == "analysis") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.analysiss != null && ploRes.analysiss.Length > 0) { foreach (AnalysisType als in ploRes.analysiss) { if (als.uid != expectString) continue; else { matchItem++; break; } } } } if (ids.ExpectedValues.GetParameter(j).Step == "analysis3d") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.analysis3Ds != null && ploRes.analysis3Ds.Length > 0) { foreach (Analysis3DType als in ploRes.analysis3Ds) { if (als.uid != expectString) continue; else { matchItem++; break; } } } } if (ids.ExpectedValues.GetParameter(j).Step == "volume") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.volumes != null && ploRes.volumes.Length > 0) { foreach (VolumeType vls in ploRes.volumes) { if (vls.uid != expectString) continue; else { matchItem++; break; } } } } if (ids.ExpectedValues.GetParameter(j).Step == "simpleinstance") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.simpleInstances != null && ploRes.simpleInstances.Length > 0) { foreach (SimpleInstanceType sis in ploRes.simpleInstances) { if (sis.uid != expectString) continue; else { matchItem++; break; } } } } if (ids.ExpectedValues.GetParameter(j).Step == "colorimage") { expectString = ids.ExpectedValues.GetParameter(j).Value; if (ploRes.images != null && ploRes.images.Length > 0) { foreach (ImageType img in ploRes.images) { if (img.uid != expectString) continue; else { matchItem++; break; } } } } } if (ids.ExpectedValues.Count == matchItem) { pLo.Outputs.AddParameter("List Object Return as expect", "List Object", "All return is matched!"); } else { pLo.Result = TestResult.Fail; pLo.Outputs.AddParameter("List Object Return Result unexpect", "List Object", "The web service return is NOT MATCH EXPECT!"); } SaveRound(r); } Output(); }
// Case 1558: 1.1.04.01 SetImage_N01_Call setImage when the original archived image file is accessible public void Run_Image_SetInfo_Normal_Case1558() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { #region Parameter initialize string patientInternalId = string.Empty; string objectFileFullPath = string.Empty; string archivePath = string.Empty; XMLParameter pSetImageInfo = new XMLParameter("image"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "importImage") { if (ids.InputParameters.GetParameter(i).Key == "objectFileFullPath") { objectFileFullPath = ids.InputParameters.GetParameter(i).Value; } else if (ids.InputParameters.GetParameter(i).Key == "archivePath") { archivePath = ids.InputParameters.GetParameter(i).Value; } } else if (ids.InputParameters.GetParameter(i).Step == "setImageInfo") { pSetImageInfo.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } #endregion #region Step 0: Create a patient for import patientInternalId = PatientService.Utility_CreatePatientForSpecificCase("case1558"); if (string.IsNullOrEmpty(patientInternalId)) { goto CLEANUP; } #endregion string imageInternalID = string.Empty; string currentPSID = string.Empty; ImportService importService = new ImportService(); #region Step 1: Call ImportService.importObject to import a image CheckPoint cpImportImage = new CheckPoint("Import Image", "Call ImportService.importObject to import an archived image"); r.CheckPoints.Add(cpImportImage); XMLResult rtImportImage = importService.importObject(patientInternalId, null, objectFileFullPath, archivePath, true, "false"); if (rtImportImage.IsErrorOccured) { cpImportImage.Result = TestResult.Fail; cpImportImage.Outputs.AddParameter("Import image returns error", "Import image", rtImportImage.Message); SaveRound(r); continue; // There is error when create image, end current run } else { cpImportImage.Result = TestResult.Pass; cpImportImage.Outputs.AddParameter("Import image returns success", "Import image", rtImportImage.Message); imageInternalID = rtImportImage.MultiResults[0].Parameters[0].ParameterValue; currentPSID = rtImportImage.MultiResults[1].Parameters[0].ParameterValue; } #endregion string imagePathAfterImport = string.Empty; string archivedPathAfterImport = string.Empty; string archiveTagAfterImport = string.Empty; ImageService imageSvc = new ImageService(); #region Step 2-1: Check the getImageDescription return is correct after import image CheckPoint cpGetImageDescriptionAfterImport = new CheckPoint("Check getImageDescription return", "Check getImageDescription return is corerct or not after import image"); r.CheckPoints.Add(cpGetImageDescriptionAfterImport); XMLResult rtGetImageDescriptionAfterImport = imageSvc.getImageDescription(imageInternalID); imagePathAfterImport = rtGetImageDescriptionAfterImport.MultiResults[0].GetParameterValueByName("path"); archivedPathAfterImport = rtGetImageDescriptionAfterImport.MultiResults[0].GetParameterValueByName("archive_path"); archiveTagAfterImport = rtGetImageDescriptionAfterImport.MultiResults[0].GetParameterValueByName("tags"); if (string.IsNullOrEmpty(imagePathAfterImport) && archivedPathAfterImport.Equals(archivePath) && string.IsNullOrEmpty(archiveTagAfterImport)) //getImageDescription should return not tags info { cpGetImageDescriptionAfterImport.Result = TestResult.Pass; cpGetImageDescriptionAfterImport.Outputs.AddParameter("getImageDescription", "Check getImageDescription return", "The getImageDescription return is correct after import image" + rtGetImageDescriptionAfterImport.ResultContent); } else { cpGetImageDescriptionAfterImport.Result = TestResult.Fail; cpGetImageDescriptionAfterImport.Outputs.AddParameter("getImageDescription", "Check getImageDescription return", "The getImageDescription return is not correct after import image. Actually get: " + rtGetImageDescriptionAfterImport.ResultContent); } #endregion #region Step 2-2: Check the info is correct in getImageInfo return after import image CheckPoint cpGetImageInfoAfterImport = new CheckPoint("Check getImageInfo return", "Check getImageInfo return is corerct or not import the image"); r.CheckPoints.Add(cpGetImageInfoAfterImport); XMLParameter pGetImageInfoAfterImport = new XMLParameter("image"); pGetImageInfoAfterImport.AddParameter("internal_id", imageInternalID); XMLResult rtGetImageInfo = imageSvc.getImageInfo(pGetImageInfoAfterImport); imagePathAfterImport = rtGetImageInfo.DicomArrayResult.GetParameterValueByName("path"); archivedPathAfterImport = rtGetImageInfo.DicomArrayResult.GetParameterValueByName("archive_path"); archiveTagAfterImport = rtGetImageInfo.DicomArrayResult.GetParameterValueByName("tags"); if (string.IsNullOrEmpty(imagePathAfterImport) && string.IsNullOrEmpty(archivedPathAfterImport) && string.IsNullOrEmpty(archiveTagAfterImport)) //&& archivePath.Equals(archivedPathAfterImport) && archiveTagAfterImport == "archived", will be supported in new service { cpGetImageInfoAfterImport.Result = TestResult.Pass; cpGetImageInfoAfterImport.Outputs.AddParameter("getImageInfo", "Check getImageInfo return", "The getImageInfo return is correct after import image." + rtGetImageInfo.ResultContent); } else { cpGetImageInfoAfterImport.Result = TestResult.Fail; cpGetImageInfoAfterImport.Outputs.AddParameter("getImageInfo", "Check getImageInfo return", "The getImageInfo return is not correct after import image. Actually get: " + rtGetImageInfo.ResultContent); } #endregion #region Step 2-3: Check the image info in listObject retrun after import, such as path, archivePath and tags CheckPoint cpListObject = new CheckPoint("listObjects", "Call PatientService.listObjects to check the archive tag"); r.CheckPoints.Add(cpListObject); NewPatientService patientSvcV2 = new NewPatientService(); PatientListObjectsRequestType pListObjects = new PatientListObjectsRequestType(); pListObjects.current = true; pListObjects.currentSpecified = true; pListObjects.patientInternalId = patientInternalId; pListObjects.type = PatientListObjectsType.presentationState; PatientListObjectsResponseType rtListObjectAfterImport = patientSvcV2.listObjects(pListObjects); if (!patientSvcV2.LastReturnXMLValidateResult.isValid) { cpListObject.Result = TestResult.Fail; cpListObject.Outputs.AddParameter("listObjects", "Check listObjects after import", "The listObjects return XML is not valid per XSD. Returned:" + patientSvcV2.LastReturnXML); } else { bool isArchivePathCorrect = string.Equals(rtListObjectAfterImport.presentationStates[0].image.archivePath, archivePath); bool isPathCorrect = string.IsNullOrEmpty(rtListObjectAfterImport.presentationStates[0].image.path); bool isTagCorrect = string.Equals(rtListObjectAfterImport.presentationStates[0].image.tags, "archived"); if (!isArchivePathCorrect || !isTagCorrect || !isPathCorrect) { cpListObject.Result = TestResult.Fail; cpListObject.Outputs.AddParameter("listObjects", "Check the image info in the listObject return value", "The tag or archivedPath info is wrong in the return. Actually get: " + patientSvcV2.LastReturnXML); } else { cpListObject.Result = TestResult.Pass; cpListObject.Outputs.AddParameter("listObjects", "Check the image info in the listObject return value", "The tag and archivedPath info is correct in the return."); } } #endregion #region Step 3: Call ImageService.SetImageInfo to save the archived image as normal image CheckPoint cpSetImageInfo = new CheckPoint("Set Image Info", "Call ImageService.SetImageInfo to save the archived image as normal image"); r.CheckPoints.Add(cpSetImageInfo); XMLResult rtSetImageInfo = imageSvc.setImageInfo(pSetImageInfo, imageInternalID); if (rtSetImageInfo.IsErrorOccured) { cpSetImageInfo.Result = TestResult.Fail; cpSetImageInfo.Outputs.AddParameter("SetImageInfo returns error", "SetImageInfo", rtSetImageInfo.Message); } else { cpSetImageInfo.Result = TestResult.Pass; cpSetImageInfo.Outputs.AddParameter("SetImageInfo returns success", "SetImageInfo", rtSetImageInfo.Message); #endregion // Wait the file is transferred to server DB System.Threading.Thread.Sleep(3000); // Below to check the info is correct after setImageInfo. Check points includes: //1. The Image ID and PS ID are not changed //2. GetImageDescription return correct image path and archive path, correct archive flag //3. GetImageInfo return correct image path, correct archive flag //4. Use the image path to check the image file is in server DB //5. The original archived image is not deleted //6. The listObject return contains correct archive tag #region Step 4: Check the ps is set, not newly created after set image CheckPoint cpPSID = new CheckPoint("Check PS ID", "Check the PS ID is not changed after call setImageInfo"); r.CheckPoints.Add(cpPSID); XMLParameter pListPS = new XMLParameter("filter"); pListPS.AddParameter("current", "true"); string currentPSIDAfterSet = imageSvc.listPresentationState(pListPS, imageInternalID).SingleResult; if (currentPSIDAfterSet == currentPSID) { cpPSID.Result = TestResult.Pass; cpPSID.Outputs.AddParameter("listPresentationState", "Check PS ID", "The PS ID is not changed"); } else { cpPSID.Result = TestResult.Fail; cpPSID.Outputs.AddParameter("listPresentationState", "Check PS ID", "The PS ID is changed. Expect: " + currentPSID + "; Actually new PS ID: " + currentPSIDAfterSet); } #endregion string imagePathAfterSet = string.Empty; string archivePathAfterSet = string.Empty; string archivedTagAfterSet = string.Empty; #region Step 5: Check the getImageDescription return is correct after set image CheckPoint cpGetImageDescriptionAfterSet = new CheckPoint("Check getImageDescription return", "Check getImageDescription return is corerct or not after call setImageInfo"); r.CheckPoints.Add(cpGetImageDescriptionAfterSet); XMLResult rtGetImageDescriptionAfterSet = imageSvc.getImageDescription(imageInternalID); imagePathAfterSet = rtGetImageDescriptionAfterSet.MultiResults[0].GetParameterValueByName("path"); archivePathAfterSet = rtGetImageDescriptionAfterSet.MultiResults[0].GetParameterValueByName("archive_path"); archivedTagAfterSet = rtGetImageDescriptionAfterSet.MultiResults[0].GetParameterValueByName("tags"); if (imagePathAfterSet.Contains(imageInternalID) && string.IsNullOrEmpty(archivePathAfterSet) && string.IsNullOrEmpty(archivedTagAfterSet)) // imagePathAfterSet sampe: C:/Documents and Settings/All Users/Application Data/TW/PAS/pas_data/patient/03/8af0a7e63310cc65013310d46d0e0003/1956bc28-ca5e-4720-a857-d4de18fc1479/02962f27-e4be-4d59-b112-9663a2f2572b.dcm" { cpGetImageDescriptionAfterSet.Result = TestResult.Pass; cpGetImageDescriptionAfterSet.Outputs.AddParameter("getImageDescription", "Check getImageDescription return", "The getImageDescription return is correct after set image"); } else { cpGetImageDescriptionAfterSet.Result = TestResult.Fail; cpGetImageDescriptionAfterSet.Outputs.AddParameter("getImageDescription", "Check getImageDescription return", "The getImageDescription return is not correct after set image. Actually get: " + rtGetImageDescriptionAfterSet.ResultContent); } #endregion #region Step 6: Check the getImageinfo return is correct after set image CheckPoint cpGetImageInfoAfterSet = new CheckPoint("Check getImageInfo return", "Check getImageInfo return is corerct or not after call setImageInfo"); r.CheckPoints.Add(cpGetImageInfoAfterSet); XMLParameter pGetImageInfoAfterSet = new XMLParameter("image"); pGetImageInfoAfterSet.AddParameter("internal_id", imageInternalID); XMLResult rtGetImageInfoAfterSet = imageSvc.getImageInfo(pGetImageInfoAfterSet); imagePathAfterSet = rtGetImageInfoAfterSet.DicomArrayResult.GetParameterValueByName("path"); archivePathAfterSet = rtGetImageInfoAfterSet.DicomArrayResult.GetParameterValueByName("archive_path"); archivedTagAfterSet = rtGetImageInfoAfterSet.DicomArrayResult.GetParameterValueByName("tags"); if (imagePathAfterSet.Contains(Utility.GetCSDMConfig(CSDMConfigSection.local, "patientDirectory")) && imagePathAfterSet.Contains(imageInternalID) && string.IsNullOrEmpty(archivePathAfterSet) && string.IsNullOrEmpty(archivedTagAfterSet)) { cpGetImageInfoAfterSet.Result = TestResult.Pass; cpGetImageInfoAfterSet.Outputs.AddParameter("getImageInfo", "Check getImageInfo return", "The getImageInfo return is correct after set image"); } else { cpGetImageInfoAfterSet.Result = TestResult.Fail; cpGetImageInfoAfterSet.Outputs.AddParameter("getImageInfo", "Check getImageInfo return", "The getImageInfo return is not correct after set image. Actually get: " + rtGetImageInfoAfterSet.ResultContent); } #endregion #region Step 7: Check the file exist in server DB CheckPoint cpImageInDB = new CheckPoint("Check file in DB", "Check the file exist in server DB after call setImageInfo"); r.CheckPoints.Add(cpImageInDB); if (Utility.IsImageExistInServerDB(imagePathAfterSet)) { cpImageInDB.Result = TestResult.Pass; cpImageInDB.Outputs.AddParameter("Check the file exist in server DB after call setImageInfo", "Check file in DB", "File exist"); } else { cpImageInDB.Result = TestResult.Fail; cpImageInDB.Outputs.AddParameter("Check the file exist in server DB after call setImageInfo", "Check file in DB", "File NOT exist"); } #endregion #region Step 8: Check the original archived image is not deleted CheckPoint cpOriginalArchivedImage = new CheckPoint("Check original archived file", "Check the original archived image is not deleted after call setImageInfo"); r.CheckPoints.Add(cpOriginalArchivedImage); if (System.IO.File.Exists(archivePath)) { cpOriginalArchivedImage.Result = TestResult.Pass; cpOriginalArchivedImage.Outputs.AddParameter("Check the original archived image is not deleted after call setImageInfo", "Check original archived file", "File exist"); } else { cpOriginalArchivedImage.Result = TestResult.Fail; cpOriginalArchivedImage.Outputs.AddParameter("Check the original archived image is not deleted after call setImageInfo", "Check original archived file", "File NOT exist"); } #endregion #region Step 9: Check the image info in listObject retrun after set, such as path, archivePath and tags CheckPoint cpListObjectAfterSet = new CheckPoint("listObjects", "Call PatientService.listObjects to check the archive tag after set"); r.CheckPoints.Add(cpListObjectAfterSet); PatientListObjectsResponseType rtListObjectAfterSet = patientSvcV2.listObjects(pListObjects); if (!patientSvcV2.LastReturnXMLValidateResult.isValid) { cpListObjectAfterSet.Result = TestResult.Fail; cpListObjectAfterSet.Outputs.AddParameter("listObjects", "Check listObjects after set", "The listObjects return XML is not valid per XSD. Returned:" + patientSvcV2.LastReturnXML); } else { //bool isPathCorrect = rtListObjectAfterSet.presentationStates[0].image.path.Contains(Utility.GetCSDMConfig(CSDMConfigSection.remote, "patientDirectory")) && rtListObjectAfterSet.presentationStates[0].image.path.Contains(imageInternalID); bool isArchivePathCorrect = string.IsNullOrEmpty(rtListObjectAfterSet.presentationStates[0].image.archivePath); bool isTagCorrect = string.IsNullOrEmpty(rtListObjectAfterSet.presentationStates[0].image.tags); if (!isArchivePathCorrect) { cpListObjectAfterSet.Result = TestResult.Fail; cpListObjectAfterSet.Outputs.AddParameter("listObjects", "Check the image info in the listObject return value", "The archivedPath info is wrong in the return. Actually get: " + patientSvcV2.LastReturnXML); } else if (!isTagCorrect) { cpListObjectAfterSet.Result = TestResult.Fail; cpListObjectAfterSet.Outputs.AddParameter("listObjects", "Check the image info in the listObject return value", "The tag info is wrong in the return. Actually get: " + patientSvcV2.LastReturnXML); } //else if (!isPathCorrect) //{ // cpListObjectAfterSet.Result = TestResult.Fail; // cpListObjectAfterSet.Outputs.AddParameter("listObjects", "Check the image info in the listObject return value", "The path info is wrong in the return. Actually get: " + patientSvc.LastReturnXML); //} else { cpListObjectAfterSet.Result = TestResult.Pass; cpListObjectAfterSet.Outputs.AddParameter("listObjects", "Check the image info in the listObject return value", "The tag and archivedPath info is correct in the return."); } } #endregion } #region Step 10: Call ImageService.deleteImage to delete the created image if (!string.IsNullOrEmpty(imageInternalID)) { CheckPoint cp_DeleteImage = new CheckPoint("Delete Image", "Call imageService.deleteImage to delete the image"); r.CheckPoints.Add(cp_DeleteImage); XMLResult rt_DeleteImage = imageSvc.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 CLEANUP: #region Step 11: Delete the patient used in this case if (!string.IsNullOrEmpty(patientInternalId)) { CheckPoint cp_DeletePatient = new CheckPoint("Step 11: Delete Patient", "Call patientService.deletePatient to delete the patient"); r.CheckPoints.Add(cp_DeletePatient); XMLResult rt_DeletePatient = PatientService.Utility_DeletePatientForSpecificCase(patientInternalId); if (rt_DeletePatient.IsErrorOccured) { cp_DeletePatient.Result = TestResult.Fail; cp_DeletePatient.Outputs.AddParameter("delete patient", "Delete patient returns error", rt_DeletePatient.Message); } else { cp_DeletePatient.Result = TestResult.Pass; cp_DeletePatient.Outputs.AddParameter("delete patient", "Delete patient returns success", rt_DeletePatient.Message); } } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString()); SaveRound(r); } } Output(); }
//Case 1570: 1.1.06.02_Import an archived FMS_Normal_contains shortcut of archived image(French FE Tool) public void Run_Import_ArchivedFMS_Case1570() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Import FMS1"); CheckPoint pImportFMS = new CheckPoint("Import FMS1", "Import FMS using conversiontool"); r.CheckPoints.Add(pImportFMS); string patientdir = ids.InputParameters.GetParameter("patientdir").Value; string patient_id = ids.InputParameters.GetParameter("patient_id").Value; string dpms_id = ids.InputParameters.GetParameter("dpms_id").Value; //call conversiontool to import archivedFMS System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = System.IO.Directory.GetCurrentDirectory() + "\\ConversionTool version 1.0.4.0\\conversiontool.exe"; p.StartInfo.Arguments = "-P\"" + patientdir + "\""; p.Start(); System.Threading.Thread.Sleep(20000); p.Kill(); string puid = null; PatientService ps = new PatientService(); XMLParameter cInputQuery = new XMLParameter("filter"); cInputQuery.AddParameter("dpms_id", dpms_id); cInputQuery.AddParameter("patient_id", patient_id); XMLResult rslQuery = ps.queryPatients(cInputQuery); if (rslQuery.IsErrorOccured) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Query Fail:", rslQuery.Message); SaveRound(r); goto CLEANUP; } puid = rslQuery.SingleResult; //trigger the post import of FMS NewPatientService nps = new NewPatientService(); PatientListObjectsRequestType request = new PatientListObjectsRequestType(); request.type = PatientListObjectsType.all; request.currentSpecified = true; request.current = true; request.patientInternalId = puid; nps.listObjects(request); //wait the post import completed System.Threading.Thread.Sleep(10000); PatientListObjectsResponseType response = nps.listObjects(request); if (!nps.LastReturnXMLValidateResult.isValid) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "List Fail:", "Response is not complied with XML Schema"); SaveRound(r); goto CLEANUP; } if (response.status.code != 0) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "List Fail:", response.status.message); SaveRound(r); goto CLEANUP; } if (response.fmss == null) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Import Fail:", "Expected 3 fms, actual none."); SaveRound(r); goto CLEANUP; } else if (response.fmss.Length != 3) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Import Fail:", "Expected 3 fms, actual:" + response.fmss.Length.ToString()); SaveRound(r); goto CLEANUP; } if (response.presentationStates == null) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Import Fail:", "Expected 21 PS, actual none."); SaveRound(r); goto CLEANUP; } else if (response.presentationStates.Length != 21) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Import Fail:", "Expected 21 PS, actual:" + response.presentationStates.Length.ToString()); SaveRound(r); goto CLEANUP; } foreach (PresentationStateType pstate in response.presentationStates) { if (pstate.image.tags != "archived" || pstate.image.archivePath == string.Empty) { pImportFMS.Result = TestResult.Fail; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Check Fail:", "archive tag or path is not correct"); SaveRound(r); goto CLEANUP; } } pImportFMS.Result = TestResult.Pass; pImportFMS.Outputs.AddParameter("archiveFMS Import", "Check Success:", "OK"); SaveRound(r); CLEANUP: if (!string.IsNullOrEmpty(puid)) { ps.deletePatient(patient_id); //delete the patient } } Output(); }
//Case 1598: 1.1.06.21_ImportDir_MainDirectory_N01 public void Run_Import_ImportDir_MainDirectory_Case1598() { int runCount = 0; NotificationSim.ReceiveNotification rn = new ReceiveNotification(); System.Collections.Generic.List<string> topics = new System.Collections.Generic.List<string>(); topics.Add("topic.postImportCompleted"); string stopTopic = "teststop"; string stopContent = "teststop"; rn.startListon(topics, stopTopic, stopContent); foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "ImportMainDir"); CheckPoint pimp = new CheckPoint("ImportDir", "Import Additional Dir"); r.CheckPoints.Add(pimp); //create patient for import PatientService ps = new PatientService(); XMLParameter cInputPatient = new XMLParameter("patient"); cInputPatient.AddParameter("first_name", "test"); cInputPatient.AddParameter("last_name", "importmaindir"); XMLResult rslCreate = ps.createPatient(cInputPatient); if (rslCreate.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Create Patient Fail", rslCreate.Message); SaveRound(r); continue; } string patientid = rslCreate.SingleResult; try { string kdis6dir = ids.InputParameters.GetParameter("kdis6_dir").Value; int retrynum = int.Parse(ids.InputParameters.GetParameter("retrynum").Value); string flag = "import"; ImportService imps = new ImportService(); XMLResult rslimport = imps.importDir(patientid, kdis6dir, flag); if (rslimport.Code != 800) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Import Fail", rslimport.Message); SaveRound(r); ps.deletePatient(patientid); continue; } int n = 0; while (rn.getRecievedNumber() == 0) { n++; if (n < retrynum) { System.Threading.Thread.Sleep(5000); } else { break; } } if (n == retrynum) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Notification Fail", "No notification recieved after retry " + n.ToString() + " times."); SaveRound(r); ps.deletePatient(patientid); continue; } ApplicationService app = new ApplicationService(); app.sendGenericNotification(stopTopic, stopContent); System.Threading.Thread.Sleep(1000); System.Collections.Generic.List<string> mmm = rn.getNotificationContent(); System.Collections.Generic.List<string> imageids = PAS.AutoTest.TestUtility.Utility.parsePostImportResult("Image", mmm[0]); System.Collections.Generic.List<string> fmsids = PAS.AutoTest.TestUtility.Utility.parsePostImportResult("FMS", mmm[0]); System.Collections.Generic.List<string> analysisids = PAS.AutoTest.TestUtility.Utility.parsePostImportResult("Analysis", mmm[0]); int expectedimgcount = int.Parse(ids.ExpectedValues.GetParameter("imgnum").Value); int expectedfmscount = int.Parse(ids.ExpectedValues.GetParameter("fmsnum").Value); int expectedanalysiscount = int.Parse(ids.ExpectedValues.GetParameter("analysisnum").Value); //check counts if (imageids.Count != expectedimgcount) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Image Count is not correct", "Actual:" + imageids.Count.ToString() + ",Expected:" + expectedimgcount.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } if (fmsids.Count != expectedfmscount) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "FMS Count is not correct", "Actual:" + fmsids.Count.ToString() + ",Expected:" + expectedfmscount.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } if (analysisids.Count != expectedanalysiscount) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Analysis Count is not correct", "Actual:" + analysisids.Count.ToString() + ",Expected:" + expectedanalysiscount.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } //get image info ImageService imgs = new ImageService(); foreach (string imgid in imageids) { XMLParameter cInputImage = new XMLParameter("image"); cInputImage.AddParameter("internal_id", imgid); XMLResult rslget = imgs.getImageInfo(cInputImage); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "GetImage Fail", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } } //get FMS info FMSService fmss = new FMSService(); foreach (string fmsid in fmsids) { XMLResult rslget = fmss.getFMSInfo(fmsid); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "GetFMS Fail", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } rslget = fmss.getFMSDescription(fmsid); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "GetFMS Fail", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } } //get Analysis info AnalysisService anas = new AnalysisService(); foreach (string analysisid in analysisids) { XMLResult rslget = anas.getAnalysisInfo(analysisid); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "GetAnalysis Fail", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } rslget = anas.getAnalysisDescription(analysisid); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "GetAnalysis Fail", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } } //check list object NewPatientService nps = new NewPatientService(); PatientListObjectsRequestType request = new PatientListObjectsRequestType(); request.currentSpecified = true; request.current = true; request.patientInternalId = patientid; request.type = PatientListObjectsType.all; PatientListObjectsResponseType response = nps.listObjects(request); //to refresh code 800 to 0 response = nps.listObjects(request); if (!nps.LastReturnXMLValidateResult.isValid) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail", "Response is not complied with schema"); SaveRound(r); ps.deletePatient(patientid); continue; } if (response.status.code != 0) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail,message: ", response.status.message); SaveRound(r); ps.deletePatient(patientid); continue; } int expectedcurrentps = int.Parse(ids.ExpectedValues.GetParameter("curpsnum").Value); int expectedcurrentfms = int.Parse(ids.ExpectedValues.GetParameter("curfmsnum").Value); int expectedcurrentanalysis = int.Parse(ids.ExpectedValues.GetParameter("curanalysisnum").Value); if (response.presentationStates.Length != expectedcurrentps) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail,current image count not correct: ", "actural:" + response.presentationStates.Length.ToString() + " expect:" + expectedcurrentps.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } //get PS PresentationStateService pss = new PresentationStateService(); foreach (PresentationStateType pst in response.presentationStates) { XMLResult rslget = pss.getPresentationState(pst.uid); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "get PS fail: ", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } } if (response.analysiss != null) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail,current analysis count not correct: ", "Expect no analysis will be returned"); SaveRound(r); ps.deletePatient(patientid); continue; } if (response.fmss.Length != expectedcurrentfms) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail,current fms count not correct: ", "actural:" + response.fmss.Length.ToString() + " expect:" + expectedcurrentfms.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } //list noncurrent objects request.currentSpecified = true; request.current = false; request.patientInternalId = patientid; request.type = PatientListObjectsType.all; response = nps.listObjects(request); int expectednoncurrentps = int.Parse(ids.ExpectedValues.GetParameter("noncurpsnum").Value); int expectednoncurrentfms = int.Parse(ids.ExpectedValues.GetParameter("noncurfmsnum").Value); int expectednoncurrentanalysis = int.Parse(ids.ExpectedValues.GetParameter("noncuranalysisnum").Value); if (response.presentationStates.Length != expectednoncurrentps) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail, non current ps count not correct: ", "actual:" + response.presentationStates.Length.ToString() + " expect:" + expectednoncurrentanalysis.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } //get PS foreach (PresentationStateType pst in response.presentationStates) { XMLResult rslget = pss.getPresentationState(pst.uid); if (rslget.IsErrorOccured) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "get PS fail: ", rslget.Message); SaveRound(r); ps.deletePatient(patientid); goto error; } } //check 3d object if (response.volumes.Length != int.Parse(ids.ExpectedValues.GetParameter("expect3dnum").Value)) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Import 3d objects fail: ", "Count is " + response.volumes.Length.ToString() + ",expect:" + ids.ExpectedValues.GetParameter("expect3dnum").Value); SaveRound(r); ps.deletePatient(patientid); continue; } if (response.analysiss.Length != expectednoncurrentanalysis) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail,non current analysis count not correct: ", "actual:" + response.analysiss.Length.ToString() + " expect:" + expectednoncurrentanalysis.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } if (response.fmss.Length != expectednoncurrentfms) { pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "list object fail,non current fms count not correct: ", "actual:" + response.fmss.Length.ToString() + " expect:" + expectednoncurrentfms.ToString()); SaveRound(r); ps.deletePatient(patientid); continue; } //Finally the test success pimp.Result = TestResult.Pass; pimp.Outputs.AddParameter("Import Main Dir", "Success", "OK"); SaveRound(r); ps.deletePatient(patientid); } catch (Exception e) { ps.deletePatient(patientid); pimp.Result = TestResult.Fail; pimp.Outputs.AddParameter("Import Main Dir", "Fail", "Exception caught,message:" + e.Message); SaveRound(r); } } error: Output(); }
// Case1572: 1.1.06.11_Import Context_Normal_contains an archived image public void Run_Import_ContextWithArchiveImage_Case1572() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { string patientdir = string.Empty; runCount++; Round r = this.NewRound(runCount.ToString(), "Acquisition"); CheckPoint pImportAnalysis = new CheckPoint("Import Context", "Import Context using conversiontool"); r.CheckPoints.Add(pImportAnalysis); PatientService pa = new PatientService(); XMLParameter query = new XMLParameter("filter"); //XMLParameter psa = new XMLParameter("presentationstate"); //XMLParameterCollection psaCollection = new XMLParameterCollection(); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "patient") { if (ids.InputParameters.GetParameter(i).Key == "patientdir") patientdir = ids.InputParameters.GetParameter(i).Value; else query.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = System.IO.Directory.GetCurrentDirectory() + "\\ConversionTool version 1.0.4.0\\conversiontool.exe"; p.StartInfo.Arguments = "-P\"" + patientdir + "\""; p.Start(); System.Threading.Thread.Sleep(20000); p.Kill(); XMLResult rslQuery = pa.queryPatients(query); string puid = null; if (rslQuery.IsErrorOccured) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveFMS Import", "Query Fail:", rslQuery.Message); goto CLEANUP; } else { puid = rslQuery.SingleResult; } NewPatientService nps = new NewPatientService(); PatientListObjectsRequestType request = new PatientListObjectsRequestType(); request.type = PatientListObjectsType.all; request.currentSpecified = true; request.current = true; request.patientInternalId = puid; nps.listObjects(request); System.Threading.Thread.Sleep(10000); PatientListObjectsResponseType response = nps.listObjects(request); if (!nps.LastReturnXMLValidateResult.isValid) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "List Fail:", "Response is not complied with XML Schema"); goto CLEANUP; } if (response.status.code != 0) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "List Fail:", response.status.message); goto CLEANUP; } if (ids.ExpectedValues.GetParameter("currentps").Value != null) { if (response.presentationStates.Length.ToString() != ids.ExpectedValues.GetParameter("currentps").Value) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "Import Fail:", "Expected" + ids.ExpectedValues.GetParameter("currentps").Value + "PS, actual:" + response.presentationStates.Length.ToString()); goto CLEANUP; } } request.current = false; // below to check non-current PS and analysis response = nps.listObjects(request); if (!nps.LastReturnXMLValidateResult.isValid) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "List Fail:", "Response is not complied with XML Schema"); goto CLEANUP; } if (response.status.code != 0) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "List Fail:", response.status.message); goto CLEANUP; } if (ids.ExpectedValues.GetParameter("noncurrentps").Value != null) { if (response.presentationStates == null || response.presentationStates.Length.ToString() != ids.ExpectedValues.GetParameter("noncurrentps").Value) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "Import Fail:", "Expected" + ids.ExpectedValues.GetParameter("noncurrentps").Value + "NON Current PS, actual response:" + nps.LastReturnXML); goto CLEANUP; } } if (ids.ExpectedValues.GetParameter("noncurrentanalysis").Value != null) { if (response.analysiss == null || response.analysiss.Length.ToString() != ids.ExpectedValues.GetParameter("noncurrentanalysis").Value) { pImportAnalysis.Result = TestResult.Fail; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "Import Fail:", "Expected" + ids.ExpectedValues.GetParameter("noncurrentanalysis").Value + "NON Current Analysis, actual response:" + nps.LastReturnXML); goto CLEANUP; } } pImportAnalysis.Result = TestResult.Pass; pImportAnalysis.Outputs.AddParameter("archiveContext Import", "success import the context", "OK"); CLEANUP: if (!string.IsNullOrEmpty(puid)) { pa.deletePatient(puid); } SaveRound(r); } Output(); }