public override Test.Framework.TestResult Run()
        {
            Test.Framework.TestVerdict expVerdict = Test.Framework.TestVerdict.Pass;
            string sh;

            DDS.ErrorCode  eh;
            DDS.ReturnCode ddsReturnCode;
            DDS.ErrorInfo  errInfo = new DDS.ErrorInfo();

            if (errInfo.Update() != DDS.ReturnCode.NoData)
            {
                return(new Test.Framework.TestResult("Update returns NO_DATA prior to error", "Update did not return NO_DATA prior to error"
                                                     , expVerdict, Test.Framework.TestVerdict.Fail));
            }
            sh            = "<>";
            ddsReturnCode = errInfo.GetLocation(out sh);
            if ((ddsReturnCode != DDS.ReturnCode.NoData))// || (!sh.Equals("<>")))
            {
                return(new Test.Framework.TestResult("get_location returns NO_DATA and does not modify string"
                                                     , "Different result and/or string modified", expVerdict, Test.Framework.TestVerdict.Fail));
            }
            ddsReturnCode = errInfo.GetMessage(out sh);
            if ((ddsReturnCode != DDS.ReturnCode.NoData))// || (!sh.Equals("<>")))
            {
                return(new Test.Framework.TestResult("get_message returns NO_DATA and does not modify string"
                                                     , "Different result and/or string modified", expVerdict, Test.Framework.TestVerdict.Fail));
            }
            ddsReturnCode = errInfo.GetStackTrace(out sh);
            if ((ddsReturnCode != DDS.ReturnCode.NoData))// || (!sh.Equals("<>")))
            {
                return(new Test.Framework.TestResult("get_stack_trace returns NO_DATA and does not modify string"
                                                     , "Different result and/or string modified", expVerdict, Test.Framework.TestVerdict.Fail));
            }
            ddsReturnCode = errInfo.GetSourceLine(out sh);
            if ((ddsReturnCode != DDS.ReturnCode.NoData))// || (!sh.Equals("<>")))
            {
                return(new Test.Framework.TestResult("get_source_line returns NO_DATA and does not modify string"
                                                     , "Different result and/or string modified", expVerdict, Test.Framework.TestVerdict.Fail));
            }
            eh            = (DDS.ErrorCode)(-1);
            ddsReturnCode = errInfo.GetCode(out eh);
            if ((ddsReturnCode != DDS.ReturnCode.NoData) || (eh != DDS.ErrorCode.Undefined))
            {
                return(new Test.Framework.TestResult("get_code returns NO_DATA and does not modify error code"
                                                     , "Different result and/or error code modified", expVerdict, Test.Framework.TestVerdict.Fail));
            }
            return(new Test.Framework.TestResult("sacs_errorinfo_tc1 successfull", "sacs_errorinfo_tc1_successfull"
                                                 , expVerdict, Test.Framework.TestVerdict.Pass));
        }
Esempio n. 2
0
        public virtual Test.Framework.TestResult Test()
        {
            Test.Framework.TestResult result;
            string sh;

            DDS.ReturnCode rc;
            DDS.ErrorInfo  errInfo = new DDS.ErrorInfo();
            rc = factory.DeleteParticipant(participant);
            if (rc != DDS.ReturnCode.Ok)
            {
                if (rc != DDS.ReturnCode.PreconditionNotMet)
                {
                    return(new Test.Framework.TestResult("Returncode did not match PreconditionNotMet"
                                                         , "Got returncode: " + rc + " expected PreconditionNotMet(4)", TestVerdict.Pass, TestVerdict.Fail));
                }
                if (errInfo.Update() != DDS.ReturnCode.Ok)
                {
                    return(new Test.Framework.TestResult("Update returns OK after the error occurred"
                                                         , "Update did not return OK after the error occurred", TestVerdict.Pass, TestVerdict.Fail));
                }

                rc = errInfo.GetLocation(out sh);
                if (rc != DDS.ReturnCode.Ok)
                {
                    return(new Test.Framework.TestResult("get_location returns OK and modifies string"
                                                         , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail));
                }
                System.Console.WriteLine("Location: " + sh);
                sh = null;
                rc = errInfo.GetMessage(out sh);
                if (rc != DDS.ReturnCode.Ok)
                {
                    return(new Test.Framework.TestResult("get_message returns OK and modifies string"
                                                         , "Different result and/or string modified", TestVerdict.Pass, TestVerdict.Fail));
                }
                System.Console.WriteLine("Message: " + sh);
                sh = null;
                rc = errInfo.GetStackTrace(out sh);
                if (rc != DDS.ReturnCode.Ok)
                {
                    return(new Test.Framework.TestResult("get_stack_trace returns OK and modifies string"
                                                         , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail));
                }
                System.Console.WriteLine("Stack trace: " + sh);
                sh = null;
                rc = errInfo.GetSourceLine(out sh);
                if (rc != DDS.ReturnCode.Ok)
                {
                    return(new Test.Framework.TestResult("get_source_line returns OK and modifies string"
                                                         , "Different result and/or string not modified", TestVerdict.Pass, TestVerdict.Fail));
                }
                System.Console.WriteLine("Source line: " + sh);
                result = new Test.Framework.TestResult("sacs_errorinfo_tc2 successfull", "sacs_errorinfo_tc2_successfull",
                                                       TestVerdict.Pass, TestVerdict.Pass);
            }
            else
            {
                result = new Test.Framework.TestResult("delete_participant should fail", "delete_participant did not fail",
                                                       TestVerdict.Pass, TestVerdict.Fail);
            }
            return(result);
        }