//Import archive public void Run_SimpleInstance_WorkFlow_Case1585() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { string instanceUID = null; ImportService importSvc = new ImportService(); SimpleInstanceServiceV2 simpleInstanceSvc = new SimpleInstanceServiceV2(); #region Input param string patientInternalId = null; string objectFileFullPath = null; string archivePath = null; SimpleSetSimpleInstanceInfoRequestType pSet = new SimpleSetSimpleInstanceInfoRequestType(); pSet.simpleInstance = new SimpleInstanceType(); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "import") // Import parameter { if (ids.InputParameters.GetParameter(i).Key == "patientInternalId") { patientInternalId = ids.InputParameters.GetParameter(i).Value; } else if (ids.InputParameters.GetParameter(i).Key == "objectFileFullPath") { objectFileFullPath = ids.InputParameters.GetParameter(i).Value; } else if (ids.InputParameters.GetParameter(i).Key == "archivePath") { archivePath = ids.InputParameters.GetParameter(i).Value; } } else if (ids.InputParameters.GetParameter(i).Step == "set") { switch (ids.InputParameters.GetParameter(i).Key) // setSimpleInstance parameter { case "filePath": pSet.simpleInstance.filePath = ids.InputParameters.GetParameter(i).Value; break; case "originalPath": pSet.simpleInstance.originalPath = ids.InputParameters.GetParameter(i).Value; break; case "instanceType": pSet.simpleInstance.instanceType = ids.InputParameters.GetParameter(i).Value; break; case "comments": pSet.simpleInstance.comments = ids.InputParameters.GetParameter(i).Value; break; case "sopInstanceUid": pSet.simpleInstance.sopInstanceUid = ids.InputParameters.GetParameter(i).Value; break; default: break; } } } #endregion #region Expected Values SimpleGetSimpleInstanceResponseType epGetAfterImport = new SimpleGetSimpleInstanceResponseType(); epGetAfterImport.simpleInstance = new SimpleInstanceType(); SimpleGetSimpleInstanceInfoResponseType epGetInfoAfterImport = new SimpleGetSimpleInstanceInfoResponseType(); epGetInfoAfterImport.simpleInstance = new SimpleInstanceType(); epGetInfoAfterImport.simpleInstance.filePath = null; SimpleGetSimpleInstanceResponseType epGetAfterSet = new SimpleGetSimpleInstanceResponseType(); epGetAfterSet.simpleInstance = new SimpleInstanceType(); SimpleGetSimpleInstanceInfoResponseType epGetInfoAfterSet = new SimpleGetSimpleInstanceInfoResponseType(); epGetInfoAfterSet.simpleInstance = new SimpleInstanceType(); epGetInfoAfterSet.simpleInstance.filePath = null; for (int i = 0; i < ids.ExpectedValues.Count; i++) { if (ids.ExpectedValues.GetParameter(i).Step == "getAfterImport") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "patientUid": epGetAfterImport.simpleInstance.patientUid = ids.ExpectedValues.GetParameter(i).Value; break; case "filePath": epGetAfterImport.simpleInstance.filePath = ids.ExpectedValues.GetParameter(i).Value; break; case "archivePath": epGetAfterImport.simpleInstance.archivePath = ids.ExpectedValues.GetParameter(i).Value; break; case "originalPath": epGetAfterImport.simpleInstance.originalPath = ids.ExpectedValues.GetParameter(i).Value; break; case "instanceType": epGetAfterImport.simpleInstance.instanceType = ids.ExpectedValues.GetParameter(i).Value; break; case "comments": epGetAfterImport.simpleInstance.comments = ids.ExpectedValues.GetParameter(i).Value; break; case "sopInstanceUid": epGetAfterImport.simpleInstance.sopInstanceUid = ids.ExpectedValues.GetParameter(i).Value; break; case "fileCreatedTime": epGetAfterImport.simpleInstance.fileCreatedTime = Utility.GetFileCreationTime(objectFileFullPath); break; case "fileModifiedTime": epGetAfterImport.simpleInstance.fileModifiedTime = Utility.GetFileModifiedTime(objectFileFullPath); break; case "tags": epGetAfterImport.simpleInstance.tags = ids.ExpectedValues.GetParameter(i).Value; break; default: break; } } else if (ids.ExpectedValues.GetParameter(i).Step == "getInfoAfterImport") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "patientUid": epGetInfoAfterImport.simpleInstance.patientUid = ids.ExpectedValues.GetParameter(i).Value; break; case "originalPath": epGetInfoAfterImport.simpleInstance.originalPath = ids.ExpectedValues.GetParameter(i).Value; break; case "archivePath": epGetInfoAfterImport.simpleInstance.archivePath = ids.ExpectedValues.GetParameter(i).Value; break; case "instanceType": epGetInfoAfterImport.simpleInstance.instanceType = ids.ExpectedValues.GetParameter(i).Value; break; case "objectType": epGetInfoAfterImport.simpleInstance.objectType = ids.ExpectedValues.GetParameter(i).Value; break; case "comments": epGetInfoAfterImport.simpleInstance.comments = ids.ExpectedValues.GetParameter(i).Value; break; case "sopInstanceUid": epGetInfoAfterImport.simpleInstance.sopInstanceUid = ids.ExpectedValues.GetParameter(i).Value; break; case "fileCreatedTime": epGetInfoAfterImport.simpleInstance.fileCreatedTime = Utility.GetFileCreationTime(objectFileFullPath); ; break; case "fileModifiedTime": epGetInfoAfterImport.simpleInstance.fileModifiedTime = Utility.GetFileModifiedTime(objectFileFullPath); break; case "fileName": epGetInfoAfterImport.simpleInstance.fileName = ids.ExpectedValues.GetParameter(i).Value; break; case "tags": epGetInfoAfterImport.simpleInstance.tags = ids.ExpectedValues.GetParameter(i).Value; break; default: break; } } else if (ids.ExpectedValues.GetParameter(i).Step == "getAfterSet") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "patientUid": epGetAfterSet.simpleInstance.patientUid = ids.ExpectedValues.GetParameter(i).Value; break; case "filePath": epGetAfterSet.simpleInstance.filePath = ids.ExpectedValues.GetParameter(i).Value; break; case "archivePath": epGetAfterSet.simpleInstance.archivePath = ids.ExpectedValues.GetParameter(i).Value; break; case "originalPath": epGetAfterSet.simpleInstance.originalPath = ids.ExpectedValues.GetParameter(i).Value; break; case "instanceType": epGetAfterSet.simpleInstance.instanceType = ids.ExpectedValues.GetParameter(i).Value; break; case "comments": epGetAfterSet.simpleInstance.comments = ids.ExpectedValues.GetParameter(i).Value; break; case "sopInstanceUid": epGetAfterSet.simpleInstance.sopInstanceUid = ids.ExpectedValues.GetParameter(i).Value; break; case "fileCreatedTime": if (pSet.simpleInstance.filePath != null) { epGetAfterSet.simpleInstance.fileCreatedTime = Utility.GetFileCreationTime(pSet.simpleInstance.filePath); } else { epGetAfterSet.simpleInstance.fileCreatedTime = epGetInfoAfterImport.simpleInstance.fileCreatedTime; } break; case "fileModifiedTime": if (pSet.simpleInstance.filePath != null) { epGetAfterSet.simpleInstance.fileModifiedTime = Utility.GetFileModifiedTime(pSet.simpleInstance.filePath); } else { epGetAfterSet.simpleInstance.fileModifiedTime = epGetInfoAfterImport.simpleInstance.fileModifiedTime; } break; case "tags": epGetAfterSet.simpleInstance.tags = ids.ExpectedValues.GetParameter(i).Value; break; default: break; } } else if (ids.ExpectedValues.GetParameter(i).Step == "getInfoAfterSet") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "patientUid": epGetInfoAfterSet.simpleInstance.patientUid = ids.ExpectedValues.GetParameter(i).Value; break; case "archivePath": epGetInfoAfterSet.simpleInstance.archivePath = ids.ExpectedValues.GetParameter(i).Value; break; case "originalPath": epGetInfoAfterSet.simpleInstance.originalPath = ids.ExpectedValues.GetParameter(i).Value; break; case "instanceType": epGetInfoAfterSet.simpleInstance.instanceType = ids.ExpectedValues.GetParameter(i).Value; break; case "objectType": epGetInfoAfterSet.simpleInstance.objectType = ids.ExpectedValues.GetParameter(i).Value; break; case "comments": epGetInfoAfterSet.simpleInstance.comments = ids.ExpectedValues.GetParameter(i).Value; break; case "sopInstanceUid": epGetInfoAfterSet.simpleInstance.sopInstanceUid = ids.ExpectedValues.GetParameter(i).Value; break; case "fileCreatedTime": if (pSet.simpleInstance.filePath != null) { epGetInfoAfterSet.simpleInstance.fileCreatedTime = Utility.GetFileCreationTime(pSet.simpleInstance.filePath); } else { epGetInfoAfterSet.simpleInstance.fileCreatedTime = epGetInfoAfterImport.simpleInstance.fileCreatedTime; } break; case "fileModifiedTime": if (pSet.simpleInstance.filePath != null) { epGetInfoAfterSet.simpleInstance.fileModifiedTime = Utility.GetFileModifiedTime(pSet.simpleInstance.filePath); } else { epGetInfoAfterSet.simpleInstance.fileModifiedTime = epGetInfoAfterImport.simpleInstance.fileModifiedTime; } break; case "fileName": epGetInfoAfterSet.simpleInstance.fileName = ids.ExpectedValues.GetParameter(i).Value; break; case "tags": epGetInfoAfterSet.simpleInstance.tags = ids.ExpectedValues.GetParameter(i).Value; break; default: break; } } } #endregion #region Step: Call import to import a normal simple instance XMLResult rtImport = importSvc.CallImportAndCheck(r, patientInternalId, objectFileFullPath, archivePath); instanceUID = rtImport.SingleResult; #endregion #region Step: Call get to a normal simple instance after create simpleInstanceSvc.CallGetAndCheck(r, instanceUID, epGetAfterImport); #endregion #region Step: Call getInfo to a normal simple isntance after create simpleInstanceSvc.CallGetInfoAndCheck(r, instanceUID, epGetInfoAfterImport); #endregion #region Step: Call set to change the simple instance property pSet.simpleInstance.uid = instanceUID; simpleInstanceSvc.CallSetAndCheck(r, pSet); #endregion //System.Threading.Thread.Sleep(3000); //Sleep to make sure the call finished #region Step: Call get to check after set simpleInstanceSvc.CallGetAndCheck(r, instanceUID, epGetAfterSet); #endregion #region Step: Call getInfo to check after set simpleInstanceSvc.CallGetInfoAndCheck(r, instanceUID, epGetInfoAfterSet); #endregion #region Step: Call delete and check //simpleInstanceSvc.CallDeleteAndCheck(r, instanceUID); #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown when case runs", "Exception message", ex.Message + ex.StackTrace); SaveRound(r); } } Output(); }
// Create normal public void Run_SimpleInstance_WorkFlow_Case1582() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { SimpleInstanceServiceV2 simpleInstanceSvc = new SimpleInstanceServiceV2(); string instanceUID = null; #region Input param SimpleCreateSimpleInstanceRequestType pCreate = new SimpleCreateSimpleInstanceRequestType(); pCreate.simpleInstance = new SimpleInstanceType(); SimpleSetSimpleInstanceInfoRequestType pSet = new SimpleSetSimpleInstanceInfoRequestType(); pSet.simpleInstance = new SimpleInstanceType(); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "createSimpleInstance") { switch (ids.InputParameters.GetParameter(i).Key) { case "patientUid": pCreate.simpleInstance.patientUid = ids.InputParameters.GetParameter(i).Value; break; case "filePath": pCreate.simpleInstance.filePath = ids.InputParameters.GetParameter(i).Value; break; case "originalPath": pCreate.simpleInstance.originalPath = ids.InputParameters.GetParameter(i).Value; break; case "instanceType": pCreate.simpleInstance.instanceType = ids.InputParameters.GetParameter(i).Value; break; case "comments": pCreate.simpleInstance.comments = ids.InputParameters.GetParameter(i).Value; break; case "sopInstanceUid": pCreate.simpleInstance.sopInstanceUid = ids.InputParameters.GetParameter(i).Value; break; default: break; } } } #endregion #region Expected Values SimpleGetSimpleInstanceResponseType epGet = new SimpleGetSimpleInstanceResponseType(); epGet.simpleInstance = new SimpleInstanceType(); SimpleGetSimpleInstanceInfoResponseType epGetInfo = new SimpleGetSimpleInstanceInfoResponseType(); epGetInfo.simpleInstance = new SimpleInstanceType(); epGetInfo.simpleInstance.filePath = null; for (int i = 0; i < ids.ExpectedValues.Count; i++) { if (ids.ExpectedValues.GetParameter(i).Step == "getSimpleInstance") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "patientUid": epGet.simpleInstance.patientUid = ids.ExpectedValues.GetParameter(i).Value; break; case "originalPath": epGet.simpleInstance.originalPath = ids.ExpectedValues.GetParameter(i).Value; break; case "instanceType": epGet.simpleInstance.instanceType = ids.ExpectedValues.GetParameter(i).Value; break; case "comments": epGet.simpleInstance.comments = ids.ExpectedValues.GetParameter(i).Value; break; case "sopInstanceUid": epGet.simpleInstance.sopInstanceUid = ids.ExpectedValues.GetParameter(i).Value; break; //case "fileCreatedTime": // when create, there is no such info, only for import // epGet.simpleInstance.fileCreatedTime = ids.ExpectedValues.GetParameter(i).Value; // break; //case "fileModifiedTime": // when create, there is no such info, only for import // epGet.simpleInstance.fileModifiedTime = ids.ExpectedValues.GetParameter(i).Value; // break; default: break; } } else if (ids.ExpectedValues.GetParameter(i).Step == "getSimpleInstanceInfo") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "patientUid": epGetInfo.simpleInstance.patientUid = ids.ExpectedValues.GetParameter(i).Value; break; case "originalPath": epGetInfo.simpleInstance.originalPath = ids.ExpectedValues.GetParameter(i).Value; break; case "instanceType": epGetInfo.simpleInstance.instanceType = ids.ExpectedValues.GetParameter(i).Value; break; case "objectType": epGetInfo.simpleInstance.objectType = ids.ExpectedValues.GetParameter(i).Value; break; case "comments": epGetInfo.simpleInstance.comments = ids.ExpectedValues.GetParameter(i).Value; break; case "sopInstanceUid": epGetInfo.simpleInstance.sopInstanceUid = ids.ExpectedValues.GetParameter(i).Value; break; //case "fileCreatedTime": // when create, there is no such info, only for import // epGetInfo.simpleInstance.fileCreatedTime = ids.ExpectedValues.GetParameter(i).Value; // break; //case "fileModifiedTime": // when create, there is no such info, only for import // epGetInfo.simpleInstance.fileModifiedTime = ids.ExpectedValues.GetParameter(i).Value; // break; case "fileName": epGetInfo.simpleInstance.fileName = ids.ExpectedValues.GetParameter(i).Value; break; default: break; } } } #endregion #region Step: Call create to create a normal simple instance instanceUID = simpleInstanceSvc.CallCreateAndCheck(r, pCreate); #endregion #region Step: Call get to a normal simple instance after create simpleInstanceSvc.CallGetAndCheck(r, instanceUID, epGet); #endregion #region Step: Call getInfo to a normal simple isntance after create simpleInstanceSvc.CallGetInfoAndCheck(r, instanceUID, epGetInfo); #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown when case runs", "Exception message", ex.Message); SaveRound(r); } } Output(); }