private void button1_Click(object sender, EventArgs e)
        {
            /*PASATCore.XMLParameter x = new XMLParameter("patient");
             * x.AddParameter("id", "P008");
             * x.AddParameter("firstname", "Felix");
             * x.AddParameter("lastname", "Jiang");
             * x.AddParameter("middlename", "J");
             * x.AddParameter("birthDate", "restore");
             * x.AddParameter("prefix", "Mr");
             * x.AddParameter("suffix", "None");
             *
             * x.AddParameter("sex", "M");
             * x.AddParameter("pregnancy", "No");
             *
             * PatientService ps = new PatientService();
             * XMLResult cc= ps.CreatePatient(x);*/

            PASATCore.AnalysisService ass = new AnalysisService();
            XMLParameter p = new XMLParameter("presentationstate");

            p.AddParameter("id", "8afa206925fce1330125fd071bc60006");
            p.AddParameter("id", "8afa206925fce1330125fd071ca1000d");

            XMLResult cc = ass.GetDescription("8af0a5d9261b4e0c01261bb5269b003d");

            string b = "false";
            bool   d = Convert.ToBoolean(b);
            int    a = 0;
        }
        private void button4_Click(object sender, EventArgs e)
        {
            int      n  = Convert.ToInt32(this.tbPatients.Text);
            DateTime dt = DateTime.Now;

            for (int i = 0; i < n; i++)
            {
                PASATCore.XMLParameter x = new XMLParameter("patient");
                x.AddParameter("id", "P008");
                x.AddParameter("firstname", "Felix");
                x.AddParameter("lastname", "Jiang");
                x.AddParameter("middlename", "J");
                x.AddParameter("birthDate", "restore");
                x.AddParameter("prefix", "Mr");
                x.AddParameter("suffix", "None");

                x.AddParameter("sex", "M");
                x.AddParameter("pregnancy", "No");

                PatientService ps = new PatientService();
                XMLResult      cc = ps.CreatePatient(x);

                this.pb.Value = (int)(i * 100 / n);
                this.Update();
            }

            System.TimeSpan t = DateTime.Now - dt;
            this.label1.Text = t.Seconds.ToString();
        }
 public static void GetPatient()
 {
     lock (c)
     {
         XMLParameter filter = new XMLParameter("filter");
         Patient.Patient p = new PASATCoreTester.Patient.Patient();
         p.getPatient("8afa206925fce1330125fce147a10001");
         c.c++;
     }
 }
 public static void GetPatient()
 {
     lock (c)
     {
         XMLParameter    filter = new XMLParameter("filter");
         Patient.Patient p      = new PASATCoreTester.Patient.Patient();
         p.getPatient("8afa206925fce1330125fce147a10001");
         c.c++;
     }
 }
        private void button5_Click(object sender, EventArgs e)
        {
            XMLParameter filter = new XMLParameter("filter");
            DateTime     dt     = DateTime.Now;

            PatientService ps = new PatientService();
            XMLResult      cc = ps.FindPatient(filter);

            System.TimeSpan t = DateTime.Now - dt;

            MessageBox.Show("Loaded " + cc.ArrayResult.Length + " patients, Cost " + (((float)t.TotalMilliseconds) / 1000).ToString() + " seconds.");
        }
        public static string CreatePresentationState(string imageId)
        {
            try
            {
                PresentationStateService ps = new PresentationStateService();

                XMLParameter psInfo = new XMLParameter("presentationstate");
                psInfo.AddParameter("general.xml", "test text for general.xml", false);
                psInfo.AddParameter("processing.xml", "test text for processing.xml", false);
                psInfo.AddParameter("annotation.xml", "test text for annotation.xml", false);
                psInfo.AddParameter("current", "true");

                return(ps.createPresentationState(imageId, psInfo).SingleResult);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static string CreatePatient()
        {
            try
            {
                string         PatientStarts = Math.Abs(Guid.NewGuid().GetHashCode()).ToString();
                PatientService ps            = new PatientService();

                XMLParameter pa = new XMLParameter("patient");
                pa.AddParameter("patient_id", PatientStarts);
                pa.AddParameter("dpms_id", PatientStarts);
                pa.AddParameter("first_name", PatientStarts);
                pa.AddParameter("last_name", PatientStarts);
                pa.AddParameter("middle_name", PatientStarts);

                XMLResult result = ps.createPatient(pa);

                return(result.SingleResult);
            }
            catch (Exception)
            { throw; }
        }
示例#8
0
        public void Run()
        {
            Round r = this.NewRound("R1", "Test round");



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

            r.CheckPoints.Add(p);

            PatientService ps = new PatientService();

            XMLParameter pa = new XMLParameter("patient");

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

            XMLResult result = ps.createPatient(pa);

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

            SaveRound(r);

            Output();

            System.Windows.Forms.MessageBox.Show("Done");
        }
示例#9
0
        public override void Run()
        {
            AcquisitionService acqService = new AcquisitionService();
            double             timeOut    = 60000; //60000ms, 60s

            XMLParameter acqInfo = new XMLParameter("acq_info");

            try
            {
                string PatientId = CommonLib.CreatePatient();
                acqInfo.AddParameter("patient_internal_id", PatientId);
                acqInfo.AddParameter("teeth_number", "12");
                acqInfo.AddParameter("teeth_number_notation", "american");
                acqInfo.AddParameter("output_encoding", "unicode");
                acqInfo.AddParameter("series_performing_physician_name", "performing_physician_name");
                acqInfo.AddParameter("mpps_information", "mpps_information");
                acqInfo.AddParameter("equipment_department_name", "equipment_department_name");
                acqInfo.AddParameter("equipment_institution_name", "equipment_institution_name");
                acqInfo.AddParameter("equipment_institution_address", "equipment_institution_address");
                acqInfo.AddParameter("equipment_station_name", "equipment_station_name");
            }
            catch (Exception ex)
            {
                LogRecordType lr = new LogRecordType();
                lr.FunctionName = this.mFunctionName;
                lr.Lable        = this.mLabel;
                string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                lr.Passed  = false;

                Log.AddRecord(lr);

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

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

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

                try
                {
                    XMLResult result = new XMLResult();

                    lr.ResponseTime = 0;
                    do
                    {
                        ExactTimer timer = new ExactTimer();
                        timer.Start();
                        result = acqService.setAsynAcqPatientInfo(acqInfo);
                        timer.Stop();

                        lr.ResponseTime += timer.Duration;

                        System.Threading.Thread.Sleep(100);
                    } while (result.ResultContent == null && lr.ResponseTime < timeOut); //loop while there is no return, and the time out is 60s

                    lr.Passed = !(result.IsErrorOccured);

                    if (!lr.Passed)
                    {
                        if (lr.ResponseTime >= timeOut)
                        {
                            lr.Message = "the service did not return after 60s. " + result.Message;
                        }
                        else
                        {
                            lr.Message = "the service return errors: " + result.Message;
                        }

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

                this.mExecuted = i;
                Log.AddRecord(lr);
                this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed);
            }

            this.RiseTestCaseCompleteEvent();
        }
示例#10
0
        public void Run_GenericInstance_ListInstances_Case1657() // Case 1657: 1.1.05.06_Call listInstances to volume to list child and slibling
        {
            int runCount = 0;

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

                CheckPoint listCheck = new CheckPoint("List Instances", "Test description");
                r.DataSet = ids;
                r.CheckPoints.Add(listCheck);

                GenericInstanceService instances = new GenericInstanceService();
                XMLParameter           pa        = new XMLParameter("filter");
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    if (ids.InputParameters.GetParameter(i).Step == "listInstances")
                    {
                        pa.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                    }
                }
                XMLResult result = instances.listInstances(pa);
                if (result.IsErrorOccured)
                {
                    listCheck.Result = TestResult.Fail;
                    listCheck.Outputs.AddParameter("listInstances fail", "list Instances", result.Message);
                }
                else
                {
                    listCheck.Outputs.AddParameter("listInstances OK", "list Instances", result.ResultContent);
                    System.Xml.XmlDocument xmlResult = new System.Xml.XmlDocument();
                    xmlResult.LoadXml(result.ResultContent);

                    System.Xml.XmlNodeList instanceList = xmlResult.SelectNodes("trophy/instance/parameter");
                    listCheck.Result = TestResult.Pass;

                    List <int> findedGroup = new List <int>();
                    int        nodeIndex   = 0;
                    foreach (System.Xml.XmlNode instance in instanceList)
                    {
                        int matchStep = 0;
                        nodeIndex++;
                        foreach (Parameter pExpected in ids.ExpectedValues.Parameters)
                        {
                            int iExpIdx = 0;
                            if (System.Int32.TryParse(pExpected.Step, out iExpIdx))
                            {
                                if (pExpected.Key == "value" &&
                                    pExpected.Value == instance.Attributes["value"].Value
                                    )
                                {
                                    matchStep = iExpIdx;
                                }
                            }
                        }
                        if (matchStep > 0)
                        {
                            bool matchKey      = false;
                            bool matchParentID = false;
                            foreach (Parameter pExpected in ids.ExpectedValues.Parameters)
                            {
                                int iExpIdx = 0;
                                if (System.Int32.TryParse(pExpected.Step, out iExpIdx))
                                {
                                    if (pExpected.Key == "key" &&
                                        pExpected.Value == instance.Attributes["key"].Value && iExpIdx == matchStep
                                        )
                                    {
                                        matchKey = true;
                                    }
                                    else if (pExpected.Key == "parent_id" &&
                                             pExpected.Value == instance.Attributes["parent_id"].Value && iExpIdx == matchStep
                                             )
                                    {
                                        matchParentID = true;
                                    }
                                }
                            }
                            if (matchKey && matchParentID)
                            {
                            }
                            else
                            {
                                listCheck.Result = TestResult.Fail;
                                string key = nodeIndex + " key or parent id unmatched";
                                listCheck.Outputs.AddParameter("listInstances", key, instance.OuterXml);
                            }
                            findedGroup.Add(matchStep);
                        }
                        else
                        {
                            listCheck.Result = TestResult.Fail;
                            string key = nodeIndex + " fail to find the instance in expected results";
                            listCheck.Outputs.AddParameter("listInstances", key, instance.InnerXml);
                        }
                    }
                    foreach (Parameter pExpected in ids.ExpectedValues.Parameters)
                    {
                        int iExpIdx = 0;
                        if (System.Int32.TryParse(pExpected.Step, out iExpIdx))
                        {
                            if (pExpected.Key == "value")
                            {
                                bool bfinded = false;
                                foreach (int matchStep in findedGroup)
                                {
                                    if (iExpIdx == matchStep)
                                    {
                                        bfinded = true;
                                        break;
                                    }
                                }
                                if (bfinded)
                                {
                                }
                                else
                                {
                                    listCheck.Result = TestResult.Fail;
                                    string key = iExpIdx + " fail to find the instance in expected results";
                                    listCheck.Outputs.AddParameter("listInstances", key, pExpected.Value);
                                }
                            }
                        }
                    }
                }
                SaveRound(r);
            }
            Output();
        }
示例#11
0
        public override void Run()
        {
            string             acqInfoString = string.Empty;
            string             sessionId     = string.Empty;
            AcquisitionService acqService    = new AcquisitionService();
            ExactTimer         timer         = new ExactTimer();
            int timeOut = 600;

            try
            {
                LaunchNotification();
                string PatientId = CommonLib.CreatePatient();

                XMLParameter acqInfo = new XMLParameter("acq_info");
                acqInfo.AddParameter("device_id", "AcqImgFiles.dll");
                acqInfo.AddParameter("line_id", "308C0000");
                acqInfo.AddParameter("patient_internal_id", PatientId);
                acqInfo.AddParameter("series_performing_physician_name", "performing_physician_name");
                acqInfoString = acqInfo.GenerateXML();
            }
            catch (Exception ex)
            {
                LogRecordType lr = new LogRecordType();
                lr.FunctionName = this.mFunctionName;
                lr.Lable        = this.mLabel;
                string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                lr.Passed  = false;

                Log.AddRecord(lr);

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

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

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

                try
                {
                    int       attemp    = 0;
                    int       errorCode = 272; //the error code for session existed.
                    XMLResult result    = new XMLResult();

                    timer.Start();

                    while (errorCode == 272)
                    {
                        result    = new XMLResult(acqService.InvokeMethod("startAcquisition", new object[] { acqInfoString }));
                        errorCode = result.Code;
                    }

                    sessionId = result.SingleResult;
                    XMLResult acqResult = acqService.getAcquisitionResult(sessionId);

                    while (acqResult.IsErrorOccured && attemp < timeOut)  //loop while the result code is 0, and the time out is 60s
                    {
                        acqResult = acqService.getAcquisitionResult(sessionId);
                        System.Threading.Thread.Sleep(100);
                        attemp++;
                    }

                    timer.Stop();

                    lr.ResponseTime = timer.Duration;
                    lr.Passed       = !(acqResult.IsErrorOccured);

                    if (!lr.Passed)
                    {
                        if (attemp >= timeOut)
                        {
                            lr.Message = "the service did not return after 60s. " + acqResult.Message;
                        }
                        else
                        {
                            lr.Message = acqResult.Message;
                        }

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

                this.mExecuted = i;
                Log.AddRecord(lr);
                if (i == this.mRepeat)
                {
                    FinishNotification();
                }
                this.RiseSingleCallCompleteEvent(lr.ResponseTime, lr.Passed);
            }

            this.RiseTestCaseCompleteEvent();
        }
示例#12
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*PASATCore.XMLParameter x = new XMLParameter("patient");
            x.AddParameter("id", "P008");
            x.AddParameter("firstname", "Felix");
            x.AddParameter("lastname", "Jiang");
            x.AddParameter("middlename", "J");
            x.AddParameter("birthDate", "restore");
            x.AddParameter("prefix", "Mr");
            x.AddParameter("suffix", "None");

            x.AddParameter("sex", "M");
            x.AddParameter("pregnancy", "No");

            PatientService ps = new PatientService();
            XMLResult cc= ps.CreatePatient(x);*/

            PASATCore.AnalysisService ass = new AnalysisService();
            XMLParameter p = new XMLParameter("presentationstate");
            p.AddParameter("id", "8afa206925fce1330125fd071bc60006");
            p.AddParameter("id", "8afa206925fce1330125fd071ca1000d");

            XMLResult cc= ass.GetDescription("8af0a5d9261b4e0c01261bb5269b003d");

            string b = "false";
            bool d = Convert.ToBoolean(b);
            int a = 0;
        }
示例#13
0
        private void button4_Click(object sender, EventArgs e)
        {
            int n=Convert.ToInt32 (this.tbPatients .Text );
            DateTime dt = DateTime.Now;
            for (int i = 0; i < n; i++)
            {
                PASATCore.XMLParameter x = new XMLParameter("patient");
                x.AddParameter("id", "P008");
                x.AddParameter("firstname", "Felix");
                x.AddParameter("lastname", "Jiang");
                x.AddParameter("middlename", "J");
                x.AddParameter("birthDate", "restore");
                x.AddParameter("prefix", "Mr");
                x.AddParameter("suffix", "None");

                x.AddParameter("sex", "M");
                x.AddParameter("pregnancy", "No");

                PatientService ps = new PatientService();
                XMLResult cc = ps.CreatePatient(x);

                this.pb.Value = (int)(i * 100 / n);
                this.Update();
            }

            System.TimeSpan t = DateTime.Now - dt;
            this.label1.Text = t.Seconds.ToString();
        }
        public override void Run()
        {
            string           openObjInfo = string.Empty;
            string           psId        = string.Empty;
            KDIS7ImageWindow iw          = new KDIS7ImageWindow();
            KDIS7ATAssistant ka          = new KDIS7ATAssistant();

            ApplicationService appService = new ApplicationService();

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

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

                openObjInfo = pa.GenerateXML();
            }
            catch (Exception ex)
            {
                LogRecordType lr = new LogRecordType();
                lr.FunctionName = this.mFunctionName;
                lr.Lable        = this.mLabel;
                string innerText = ex.InnerException == null ? string.Empty : ex.InnerException.Message;
                lr.Message = ex.Message + innerText == string.Empty ? string.Empty : "(" + innerText + ")";
                lr.Passed  = false;

                Log.AddRecord(lr);

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

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

                return;
            }

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

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

                    bool imageOpened = iw.ItemByID(psId).WaitProperty("ShownOnScreen", true, 30);

                    System.Threading.Thread.Sleep(3000);

                    ka.CleanApp("Default");

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

                    if (!lr.Passed)
                    {
                        if (result.IsErrorOccured)
                        {
                            lr.Message = "Call openObjects returns error: " + result.Message;
                        }
                        else
                        {
                            lr.Message = "Failed to open CSI.";
                        }

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

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

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

            this.RiseTestCaseCompleteEvent();
        }
        public override void Run()
        {
            string newPSId                     = string.Empty;
            string setPSInfoString             = string.Empty;
            string getPSInfoString             = string.Empty;
            PresentationStateService psService = new PresentationStateService();

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

                Log.AddRecord(lr);

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

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

            double userCaseResponse = 0;

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

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

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


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

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

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

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

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

            this.RiseTestCaseCompleteEvent();
        }
        public override void Run()
        {
            string PatientStarts = string.Empty;
            Random random        = new Random(Guid.NewGuid().GetHashCode());

            PatientStarts += Convert.ToChar(random.Next(65, 91));
            PatientStarts += Convert.ToChar(random.Next(65, 91));
            PatientStarts += Convert.ToChar(random.Next(65, 91));
            PatientStarts += Convert.ToChar(random.Next(65, 91));

            PatientService ps = new PatientService();

            XMLParameter pa = new XMLParameter("patient");

            pa.AddParameter("patient_id", "$_R");
            pa.AddParameter("dpms_id", "$_R");
            pa.AddParameter("first_name", "$_R");
            pa.AddParameter("last_name", "$_R");
            pa.AddParameter("middle_name", "$_R");
            pa.AddParameter("prefix", "Mr");
            pa.AddParameter("suffix", "X");
            pa.AddParameter("birth_date", "2010-10-22");
            pa.AddParameter("sex", "female");
            pa.AddParameter("pregnancy", "not pregnant");
            pa.AddParameter("insurance_number", "1234567");
            pa.AddParameter("address", "Test address");
            pa.AddParameter("town", "test town");
            pa.AddParameter("postal_code", "female");
            pa.AddParameter("cellular_phone", "female");
            pa.AddParameter("home_phone", "female");
            pa.AddParameter("work_phone", "female");
            pa.AddParameter("comments", "user comments");
            pa.AddParameter("email", "*****@*****.**");
            pa.AddParameter("photo", "");

            string PatientInfo = pa.GenerateXML();

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

                try
                {
                    XMLResult result = new XMLResult(ps.InvokeMethod("createPatient", new object[] { PatientInfo.Replace("$_R", PatientStarts + (i + 1).ToString()) }));
                    lr.ResponseTime = ps.ResponseTime;
                    lr.Passed       = !(result.IsErrorOccured);

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

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

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

            this.RiseTestCaseCompleteEvent();
        }
        public void Run_RadioLogicalLog_WorkFlow_N03_CreateSetGet_Case927() //Case 927: 1.3.3_WorkFlow_N03_CreateSetGet
        {
            //int runCount = this.Input.Repetition;

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

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

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

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

                //create required PAS service instaces here
                PatientService  pats   = new PatientService();
                RadiologService radios = new RadiologService();

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


                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    switch (ids.InputParameters.GetParameter(i).Step)
                    {
                    case "createPatient":
                        pa1.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        break;

                    case "createRadioLogEntry":
                        pa2.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        break;

                    case "setRadioLogEntry":
                        pa3.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        break;

                    case "getRadioLogEntry":
                        pa4.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value);
                        break;

                    default:
                        Console.WriteLine("There is no valid selection when parse input parameters.");
                        break;
                    }
                }

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

                //Get service result
                //Step1 result

                XMLResult step1_result = pats.createPatient(pa1);

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

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


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

                //Step2 result

                XMLResult step2_result = radios.createRadioLogEntry(pa2);

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

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


                //Change input parameter according the output of Step2


                //Step3 result

                XMLResult step3_result = radios.setRadioLogEntry(pa3, step2_result.SingleResult);

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

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


                //Change input parameter according the output of Step3

                //Step4 result

                XMLResult step4_result = radios.getRadioLogEntry(step2_result.SingleResult);

                //Log step4 service output

                //Compare the Expected parameters of getRadioLogEntry and output result of getRadioLogEntry
                int compCount = 0;

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

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

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

            //Save service log as xml file
            Output();
        }
示例#18
0
        private void button5_Click(object sender, EventArgs e)
        {
            XMLParameter filter = new XMLParameter("filter");
            DateTime dt = DateTime.Now;

            PatientService ps = new PatientService();
            XMLResult cc= ps.FindPatient(filter);

            System.TimeSpan t = DateTime.Now - dt;

            MessageBox.Show("Loaded " + cc.ArrayResult.Length + " patients, Cost " + (((float)t.TotalMilliseconds) / 1000).ToString() + " seconds.");
        }