コード例 #1
0
        public void Run_GenericInstance_InvalidInstanceId_Case1568()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "SetGetCommentsV2");
                GenericIntanceServiceV2 gisv2 = new GenericIntanceServiceV2();

                GenericSetGenericInstanceInfoRequestType setRequest = new GenericSetGenericInstanceInfoRequestType();
                setRequest.instance = new InstanceType();
                string instanceid = ids.InputParameters.GetParameter("instanceid").Value;
                int    expectcode = int.Parse(ids.ExpectedValues.GetParameter("expectcode").Value);
                setRequest.instance.uid      = instanceid;
                setRequest.instance.comments = "Test";

                GenericGetGenericInstanceInfoResponseType getResp = gisv2.getGenericInstanceInfo(instanceid);

                CheckPoint pComments = new CheckPoint("GetSet Comments", "GetSet Comments Invalid Instance id");
                r.CheckPoints.Add(pComments);
                if (getResp.status.code != 1003)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Get Fail", "Code not expected, actual:" + getResp.status.code.ToString() + ", expect:1003");
                    SaveRound(r);
                    continue;
                }

                if (!gisv2.LastReturnXMLValidateResult.isValid)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Get Set Fail", "Response is not complied with Schema");
                    SaveRound(r);
                    continue;
                }


                GenericSetGenericInstanceInfoResponseType setResp = gisv2.setGenericInstanceInfo(setRequest);
                if (setResp.status.code != 1003)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Set Fail", "Code not expected, actual:" + setResp.status.code.ToString() + ", expect:1003");
                    SaveRound(r);
                    continue;
                }

                if (!gisv2.LastReturnXMLValidateResult.isValid)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Get Set Fail", "Response is not complied with Schema");
                    SaveRound(r);
                    continue;
                }

                pComments.Result = TestResult.Pass;
                pComments.Outputs.AddParameter("GetSet Comments Invalid instance id", "Success", "OK");
                SaveRound(r);
            }

            Output();
        }
コード例 #2
0
        public void Run_GenericInstance_SetGetComment_Case1551()
        {
            int runCount = 0;

            foreach (InputDataSet ids in this.Input.DataSets)
            {
                runCount++;
                Round r = this.NewRound(runCount.ToString(), "SetGetCommentsV2");
                GenericIntanceServiceV2 gisv2 = new GenericIntanceServiceV2();

                GenericSetGenericInstanceInfoRequestType setRequest = new GenericSetGenericInstanceInfoRequestType();
                setRequest.instance = new InstanceType();
                string getInstanceid = string.Empty;
                for (int i = 0; i < ids.InputParameters.Count; i++)
                {
                    switch (ids.InputParameters.GetParameter(i).Step)
                    {
                    case "setInstanceInfo":
                        switch (ids.InputParameters.GetParameter(i).Key)
                        {
                        case "instanceid":
                            setRequest.instance.uid = ids.InputParameters.GetParameter(i).Value;
                            break;

                        case "comments":
                            setRequest.instance.comments = ids.InputParameters.GetParameter(i).Value;
                            break;
                        }
                        break;

                    case "getInstanceInfo":

                        switch (ids.InputParameters.GetParameter(i).Key)
                        {
                        case "instanceid":
                            getInstanceid = ids.InputParameters.GetParameter(i).Value;
                            break;
                        }
                        break;
                    }
                }

                CheckPoint pComments = new CheckPoint("GetSet Comments", "GetSet Comments");
                r.CheckPoints.Add(pComments);

                GenericSetGenericInstanceInfoResponseType setResponse = gisv2.setGenericInstanceInfo(setRequest);
                if (!gisv2.LastReturnXMLValidateResult.isValid)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Invalid XML", "Set response is not complied with schema.");
                    SaveRound(r);
                    continue;
                }

                if (setResponse.status.code != 0)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Set Fail", "Set Fail.Code:" + setResponse.status.code.ToString() + " Message:" + setResponse.status.message);
                    SaveRound(r);
                    continue;
                }
                GenericGetGenericInstanceInfoResponseType getResponse = gisv2.getGenericInstanceInfo(getInstanceid);
                if (!gisv2.LastReturnXMLValidateResult.isValid)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Invalid XML", "Get response is not complied with schema.");
                    SaveRound(r);
                    continue;
                }
                if (getResponse.status.code != 0)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "Get Fail", "Get Fail.Code:" + getResponse.status.code.ToString() + " Message:" + getResponse.status.message);
                    SaveRound(r);
                    continue;
                }
                if (setRequest.instance.comments != getResponse.instance.comments)
                {
                    pComments.Result = TestResult.Fail;
                    pComments.Outputs.AddParameter("GetSet Comments", "GetSet Fail", "Set value is not equal to get value");
                    SaveRound(r);
                    continue;
                }
                else
                {
                    pComments.Result = TestResult.Pass;
                    pComments.Outputs.AddParameter("GetSet Comments", "GetSet Success", "OK");
                    //cleanup the comments value
                    setRequest.instance.comments = "Initialized Comments";
                    gisv2.setGenericInstanceInfo(setRequest);
                    SaveRound(r);
                }
            }
            Output();
        }
コード例 #3
0
        public void Run_GenericInstance_SetGetTag_Case1579()  // Case 1579: 1.1.05.04_Set and Get Tags_Normal, added for check the set and get function to Generic Instance tags
        {
            int runCount = 0;

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

                try
                {
                    GenericIntanceServiceV2 genericInstanceSvc = new GenericIntanceServiceV2();

                    string instanceUID = string.Empty;
                    GenericSetGenericInstanceInfoRequestType setRequest = new GenericSetGenericInstanceInfoRequestType();
                    setRequest.instance = new InstanceType();
                    for (int i = 0; i < ids.InputParameters.Count; i++)
                    {
                        if (ids.InputParameters.GetParameter(i).Step == "setInstanceInfo")
                        {
                            if (ids.InputParameters.GetParameter(i).Key == "instanceID")
                            {
                                setRequest.instance.uid = ids.InputParameters.GetParameter(i).Value;
                            }
                            else if (ids.InputParameters.GetParameter(i).Key == "tags")
                            {
                                setRequest.instance.tags = ids.InputParameters.GetParameter(i).Value;;
                            }
                        }
                    }

                    string epCode    = string.Empty;
                    string epMessage = string.Empty;
                    for (int i = 0; i < ids.ExpectedValues.Count; i++)
                    {
                        if (ids.ExpectedValues.GetParameter(i).Key == "code")
                        {
                            epCode = ids.ExpectedValues.GetParameter(i).Value;
                        }
                        else if (ids.ExpectedValues.GetParameter(i).Key == "message")
                        {
                            epMessage = ids.ExpectedValues.GetParameter(i).Value;
                        }
                    }

                    CheckPoint pSetTags = new CheckPoint("Set Tags", "Set Tags");
                    r.CheckPoints.Add(pSetTags);

                    GenericSetGenericInstanceInfoResponseType setResponse = genericInstanceSvc.setGenericInstanceInfo(setRequest);
                    if (!genericInstanceSvc.LastReturnXMLValidateResult.isValid)
                    {
                        pSetTags.Result = TestResult.Fail;
                        pSetTags.Outputs.AddParameter("Set Tags", "Invalid XML", "Set response is not complied with schema.");
                        SaveRound(r);
                        continue;
                    }

                    if (setResponse.status.code.ToString() != epCode || !setResponse.status.message.Contains(epMessage))
                    {
                        pSetTags.Result = TestResult.Fail;
                        pSetTags.Outputs.AddParameter("Set Tags", "Check the set response", "Set doesn't return expected result.  Code:" + setResponse.status.code.ToString() + "; Message:" + setResponse.status.message);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        pSetTags.Result = TestResult.Pass;
                        pSetTags.Outputs.AddParameter("Set Tags", "Check the set response", "Set returns expected result. Code:" + setResponse.status.code.ToString() + "; Message:" + setResponse.status.message);
                    }

                    CheckPoint pGetTags = new CheckPoint("Get Tags", "Get Tags");
                    r.CheckPoints.Add(pGetTags);

                    instanceUID = setRequest.instance.uid;
                    GenericGetGenericInstanceInfoResponseType getResponse = genericInstanceSvc.getGenericInstanceInfo(instanceUID);
                    if (!genericInstanceSvc.LastReturnXMLValidateResult.isValid)
                    {
                        pGetTags.Result = TestResult.Fail;
                        pGetTags.Outputs.AddParameter("Get Tags", "Invalid XML", "Get response is not complied with schema. Actually get: " + genericInstanceSvc.LastReturnXML);
                        SaveRound(r);
                        continue;
                    }

                    if (getResponse.status.code != 0)
                    {
                        pGetTags.Result = TestResult.Fail;
                        pGetTags.Outputs.AddParameter("Get Tags", "Get Fail", "Get Fail.Code:" + getResponse.status.code.ToString() + " Message:" + getResponse.status.message);
                        SaveRound(r);
                        continue;
                    }

                    if (setRequest.instance.tags != getResponse.instance.tags)
                    {
                        pGetTags.Result = TestResult.Fail;
                        pGetTags.Outputs.AddParameter("Get Tags", "Get Fail", "Get value is not equal to set value." + "Expect: " + setRequest.instance.tags + "; Actually get: " + getResponse.instance.tags);
                        SaveRound(r);
                        continue;
                    }
                    else
                    {
                        pGetTags.Result = TestResult.Pass;
                        pGetTags.Outputs.AddParameter("Get Tags", "Get Success", genericInstanceSvc.LastReturnXML);
                    }

                    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.Message);
                    SaveRound(r);
                }
            }

            Output();
        }