当前位置: 首页>>代码示例>>C#>>正文


C# ITestSite.CaptureRequirementIfIsNotNull方法代码示例

本文整理汇总了C#中ITestSite.CaptureRequirementIfIsNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# ITestSite.CaptureRequirementIfIsNotNull方法的具体用法?C# ITestSite.CaptureRequirementIfIsNotNull怎么用?C# ITestSite.CaptureRequirementIfIsNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITestSite的用法示例。


在下文中一共展示了ITestSite.CaptureRequirementIfIsNotNull方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CaptureScopesElementRequirements

        /// <summary>
        /// Capture requirements for Scope structure
        /// </summary>
        /// <param name="scopes">Scope structure</param>
        /// <param name="site">A instance of ITestSite.</param>
        public static void CaptureScopesElementRequirements(ScopesType scopes, ITestSite site)
        {
            // Add debug info
            site.Log.Add(LogEntryKind.Debug, "Scopes: {0}", scopes);

            site.CaptureRequirementIfIsNotNull(
                scopes,
                55,
                @"[In Scopes] Each element in the list is actually a UTF-8-encoded string representation of
                the HoHoDk value in hexBinary format [XMLSCHEMA1.1/2] [and represents one segment].");

            // Add debug info
            site.Log.Add(LogEntryKind.Debug, "Scopes: {0}", scopes);
            site.CaptureRequirementIfIsTrue(
                scopes.Text.Length > 0,
                158,
                @"[The <Scopes> element represents the list of discovery provider scopes, where]
                each element in the list is a string.");
        }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:24,代码来源:PccrdBothRoleCaptureCode.cs

示例2: VerifyFsshttpbSubResponse

        /// <summary>
        /// This method is used to test Sub-Responses related adapter requirements.
        /// </summary>
        /// <param name="instance">Specify the instance which need to be verified.</param>
        /// <param name="site">Specify the ITestSite instance.</param>
        public void VerifyFsshttpbSubResponse(FsshttpbSubResponse instance, ITestSite site)
        {
            // If the instance is not null and there are no parsing errors, then the Sub-Responses related adapter requirements can be directly captured.
            if (null == instance)
            {
                site.Assert.Fail("The instance of type FsshttpbSubResponse is null due to parsing error or type casting error.");
            }

            // Verify the stream object header related requirements.
            this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site);

            // Directly capture requirement MS-FSSHTTPB_R548, if the header start type is StreamObjectHeaderStart32bit.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(StreamObjectHeaderStart32bit),
                     instance.StreamObjectHeaderStart.GetType(),
                     "MS-FSSHTTPB",
                     548,
                     @"[In Sub-Responses] Sub-response Start (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies a sub-response start.");

            RequestTypes expectTypeValue = MsfsshttpbSubRequestMapping.GetSubRequestType((int)instance.RequestID.DecodedValue, site);

            // Capture requirement MS-FSSHTTPB_R549, if the request type is consistent with the expected value.
            site.CaptureRequirementIfAreEqual<RequestTypes>(
                     expectTypeValue,
                     (RequestTypes)instance.RequestType.DecodedValue,
                     "MS-FSSHTTPB",
                     549,
                     @"[In Sub-Responses] Request ID (variable): A compact unsigned 64-bit integer (section 2.2.1.1) that specifies the request number this sub-response is for.");

            // Capture requirement MS-FSSHTTPB_R550, if the request type is consistent with the expected value.
            site.CaptureRequirementIfAreEqual<RequestTypes>(
                     expectTypeValue,
                     (RequestTypes)instance.RequestType.DecodedValue,
                     "MS-FSSHTTPB",
                     550,
                     @"[In Sub-Responses] Request Type (variable): A compact unsigned 64-bit integer that specifies the request type (section 2.2.1.6) matching the request.");

            // Verify the request types related requirements.
            this.VerifyRequestTypes((RequestTypes)instance.RequestType.DecodedValue, site);

            if (instance.Status == true)
            {
                site.Log.Add(
                        LogEntryKind.Debug,
                        "When the status is set, the response error should exist.");

                // Capture requirement MS-FSSHTTPB_R552, if the response error is exist when the status is set.
                site.CaptureRequirementIfIsNotNull(
                         instance.ResponseError,
                         "MS-FSSHTTPB",
                         552,
                         @"[In Sub-Responses] A - Status (1 bit): If set, A response error (section 2.2.3.2) MUST follow.");

                // Capture requirement MS-FSSHTTPB_R551, if the response error is exist when the status is set.
                site.CaptureRequirementIfIsNotNull(
                         instance.ResponseError,
                         "MS-FSSHTTPB",
                         551,
                         @"[In Sub-Responses] A - Status (1 bit): If set, a bit that specifies the sub-request has failed.");

                // Directly capture requirement MS-FSSHTTPB_R555, if there are no parsing errors. 
                site.CaptureRequirement(
                         "MS-FSSHTTPB",
                         555,
                         @"[In Sub-Responses] Sub-response data (variable): A response error that specifies the error information about failure of the sub-request.");
            }
            else
            {
                site.Assert.IsNotNull(
                            instance.SubResponseData,
                            "When the status is not set, the response data cannot be null.");

                switch ((int)instance.RequestType.DecodedValue)
                {
                    case 1:
                        site.Assert.AreEqual<Type>(
                                    typeof(QueryAccessSubResponseData),
                                    instance.SubResponseData.GetType(),
                                    "When the request type value equals to 1, then the response data MUST be the type QueryAccessSubResponseData");

                        // Directly capture requirement MS-FSSHTTPB_R578, if the above assertion was validated.
                        site.CaptureRequirement(
                                 "MS-FSSHTTPB",
                                 578,
                                 @"[In Sub-Responses][Request Type is set to ]1 [specifies the Sub-response data is  for the ]Query access (section 2.2.3.1.1)[operation].");
                        break;

                    case 2:
                        site.Assert.AreEqual<Type>(
                                    typeof(QueryChangesSubResponseData),
                                    instance.SubResponseData.GetType(),
                                    "When the request type value equals to 2, then the response data MUST be the type QueryChangesSubResponseData");

                        // Directly capture requirement MS-FSSHTTPB_R579, if the above assertion was validated.
                        site.CaptureRequirement(
//.........这里部分代码省略.........
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:101,代码来源:MsfsshttpbResponseCapture.cs

示例3: ValidateGetDocMetaInfoSubResponse

        /// <summary>
        /// Capture requirements related to GetDocMetaInfo sub response.
        /// </summary>
        /// <param name="getDocMetaInfoSubResponse">Containing the GetDocMetaInfoSubResponse information.</param>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        public static void ValidateGetDocMetaInfoSubResponse(GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse, ITestSite site)
        {
            ValidateSubResponseType(getDocMetaInfoSubResponse as SubResponseType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1797
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     1797,
                     @"[In GetDocMetaInfoSubResponseType][The schema of GetDocMetaInfoSubResponseType is] <xs:complexType name=""GetDocMetaInfoSubResponseType"">
                       <xs:complexContent>
                         <xs:extension base=""tns:SubResponseType"">
                           <xs:sequence minOccurs=""0"" maxOccurs=""1"">
                     <xs:element name=""SubResponseData"" type=""tns:GetDocMetaInfoSubResponseDataType""/>
                     </xs:sequence>
                         </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2003
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     2003,
                     @"[In GetDocMetaInfo Subrequest][The protocol client sends a GetDocMetaInfo SubRequest message, which is of type GetDocMetaInfoSubRequestType] The protocol server responds with a GetDocMetaInfo SubResponse message, which is of type GetDocMetaInfoSubResponseType as specified in section 2.3.1.30.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694
            // if can launch this method, the schema matches.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(GetDocMetaInfoSubResponseType),
                     getDocMetaInfoSubResponse.GetType(),
                     "MS-FSSHTTP",
                     4694,
                     @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetDocMetaInfoSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5748
            // if can launch this method, the schema matches.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(GetDocMetaInfoSubResponseType),
                     getDocMetaInfoSubResponse.GetType(),
                     "MS-FSSHTTP",
                     5748,
                     @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: GetDocMetaInfoSubResponseType.");

            if (getDocMetaInfoSubResponse.SubResponseData != null)
            {
                ValidateGetDocMetaInfoSubResponseData(site);
            }

            if (string.Compare("Success", getDocMetaInfoSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1693
                bool isVerifyR1693 = getDocMetaInfoSubResponse.SubResponseData != null;

                // If popup the assert, the case run fail. 
                site.Assert.IsTrue(
                            isVerifyR1693,
                            "For requirement MS-FSSHTTPB_R1693, the SubResponseData should not be NULL.");

                // If the above logic is right, MS-FSSHTTP_R1693 can be captured.
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         1693,
                         @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""GetDocMetaInfo"".");

                // If the value of element "SubResponseData" in the sub-response is not null, then capture MS-FSSHTTP_R1800.
                site.CaptureRequirementIfIsNotNull(
                         getDocMetaInfoSubResponse.SubResponseData,
                         "MS-FSSHTTP",
                         1800,
                         @"[In GetDocMetaInfoSubResponseType] [In GetDocMetaInfoSubResponseType] As part of processing the GetDocMetaInfo subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true:
                         The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");
            }

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2013
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     2013,
                     @"[In GetDocMetaInfo Subrequest] The GetDocMetaInfoPropertySetType elements have one Property element per metadata item of type GetDocMetaInfoPropertyType as defined in section 2.3.1.29.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1685
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     1685,
                     @"[In SubResponseDataGenericType][SubResponseDataGenericType MUST take one of the forms described in the following table] GetDocMetaInfoSubResponseDataType: Type definition for Get Doc Meta Info subresponse data.");
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:93,代码来源:MsfsshttpGetDocMetaInfoCapture.cs

示例4: ValidateResponseElement

        /// <summary>
        /// Capture requirements related with Response element.
        /// </summary>
        /// <param name="response">The Response information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateResponseElement(Response response, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R97
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     97,
                     @"[In Response][Response element schema is:]
                     <xs:element name=""Response"">
                       <!--Allows for the numbers to be displayed between the SubResponse elements-->
                       <xs:complexType mixed=""true"">
                         <xs:sequence minOccurs=""1"" maxOccurs=""unbounded"">
                           <xs:element name=""SubResponse"" type=""tns:SubResponseElementGenericType"" /> 
                         </xs:sequence>
                         <xs:attribute name=""Url"" type=""xs:string"" use=""required""/>
                         <xs:attribute name=""RequestToken"" type=""xs:nonNegativeInteger"" use=""required"" />
                         <xs:attribute name=""HealthScore"" type=""xs:integer"" use=""required""/>
                         <xs:attribute name=""ErrorCode"" type=""tns:GenericErrorCodeTypes"" use=""optional"" />
                         <xs:attribute name=""ErrorMessage"" type=""xs:string"" use=""optional""/>
                       </xs:complexType>
                     </xs:element>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R104
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R104, the Url attribute value should be specified, the actual Url value is: {0}",
                response.Url != null ? response.Url : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     response.Url,
                     "MS-FSSHTTP",
                     104,
                     @"[In Response] The Url attribute MUST be specified for each Response element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1482
            // The responseElement.SubResponse.Length specifies the number of SubResponse element in Response.
            bool isVerifiedR96 = response.SubResponse.Length >= 1;
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R1482, the Response element should contain one or more SubResponse elements, the actual SubResponse elements number is: {0}",
                response.SubResponse.Length.ToString());

            site.CaptureRequirementIfIsTrue(
                     isVerifiedR96,
                     "MS-FSSHTTP",
                     96,
                     @"[In Response] Each Response element MUST contain one or more SubResponse elements.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R107
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R263, the RequestToken should be specified, the actual RequestToken value is: {0}",
                response.RequestToken != null ? response.RequestToken : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     response.RequestToken,
                     "MS-FSSHTTP",
                     107,
                     @"[In Response] The RequestToken MUST be specified for each Response element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2076
            bool isVerifyR2076 = int.Parse(response.HealthScore) <= 10 && int.Parse(response.HealthScore) >= 0;
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R2076, the HealthScore value should be between 0 and 10, the actual HealthScore value is: {0}",
                response.HealthScore);

            site.CaptureRequirementIfIsTrue(
                     isVerifyR2076,
                     "MS-FSSHTTP",
                     2076,
                     @"[In Response] HealthScore: An integer which value is between 0 and 10.");

            // Verify requirements related with SubResponse element
            if (response.SubResponse != null)
            {
                foreach (SubResponseElementGenericType subResponse in response.SubResponse)
                {
                    ValidateSubResponseElement(subResponse, site);
                }
            }

            // Verify requirements related with GenericErrorCodeTypes
            if (response.ErrorCodeSpecified)
            {
                ValidateGenericErrorCodeTypes(site);
            }
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:92,代码来源:MsfsshttpCommonCapture.cs

示例5: ValidateSubResponseType

        /// <summary>
        /// Capture requirements related with SubResponseType
        /// </summary>
        /// <param name="subResponse">The SubResponseType information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateSubResponseType(SubResponseType subResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R281
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     281,
                     @"[In SubResponseType][SubResponseType schema is:]
                     <xs:complexType name=""SubResponseType"">
                        <xs:attribute name=""SubRequestToken"" type=""xs:nonNegativeInteger"" use=""required""/>
                        <xs:attribute name=""ErrorCode"" type=""tns:ErrorCodeTypes"" use=""required"" />
                        <xs:attribute name=""HResult"" type=""xs:integer"" use=""required"" fixed=""0""/>
                        <xs:attribute name=""ErrorMessage"" type=""xs:string"" use=""optional""/> 
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R284
            // If the SubRequestToken attribute isn't null, then capture MS-FSSHTTP_R284.  
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R284, the SubRequestToken should be specified, the actual SubRequestToken value is: {0}",
                subResponse.SubRequestToken != null ? subResponse.SubRequestToken : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     subResponse.SubRequestToken,
                     "MS-FSSHTTP",
                     284,
                     @"[In SubResponseType] The SubRequestToken attribute MUST be specified for a SubResponse element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R290
            // If the ErrorCode attribute is not null, capture R290.
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R290, the ErrorCode attribute should be specified, the actual ErrorCode value is: {0}",
                subResponse.ErrorCode != null ? subResponse.ErrorCode : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     subResponse.ErrorCode,
                     "MS-FSSHTTP",
                     290,
                     @"[In SubResponseType] The ErrorCode attribute MUST be specified for a SubResponse element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1003
            site.CaptureRequirementIfIsNotNull(
                     subResponse.ErrorCode,
                     "MS-FSSHTTP",
                     1003,
                     @"[In Coauth Subrequest][The protocol server returns results based on the following conditions:]  Depending on the type of error, ErrorCode is returned as an attribute of the SubResponse element.");

            if (subResponse.ErrorCode != null)
            {
                ErrorCodeType errorCode;
                site.Assert.IsTrue(Enum.TryParse<ErrorCodeType>(subResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", subResponse.ErrorCode);

                // Verify requirements related with ErrorCodeTypes
                ValidateErrorCodeTypes(errorCode, site);
            }
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:61,代码来源:MsfsshttpCommonCapture.cs

示例6: ValidateResponseCollection

        /// <summary>
        /// Capture requirements related with ResponseCollection
        /// </summary>
        /// <param name="responseCollection">The ResponseCollection information</param>
        /// <param name="requestToken">The expected RequestToken</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateResponseCollection(ResponseCollection responseCollection, string requestToken, ITestSite site)
        {
            // Verify MS-FSSHTTP_R19
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     19,
                     @"[In Response] [The Body element of each SOAP response message MUST contain] zero or more ResponseCollection elements.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R121
            // If WebUrl is not null, WebUrl attribute is specified.
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R121, the WebUrl attribute should be specified, the actual WebUrl value is: {0}",
                responseCollection.WebUrl != null ? responseCollection.WebUrl : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     responseCollection.WebUrl,
                     "MS-FSSHTTP",
                     121,
                     @"[In ResponseCollection] The WebUrl attribute MUST be specified for each ResponseCollection element.");

            // Now here only supported one request.
            if (responseCollection.Response != null && responseCollection.Response.Length >= 1)
            {
                MsfsshttpAdapterCapture.ValidateResponseElement(responseCollection.Response[0], site);
                MsfsshttpAdapterCapture.ValidateResponseToken(responseCollection.Response[0], requestToken, site);
            }
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:34,代码来源:MsfsshttpCommonCapture.cs

示例7: ValidateWhoAmISubResponse

        /// <summary>
        /// Capture requirements related with WhoAmI Sub-request.
        /// </summary>
        /// <param name="whoamiSubResponse">Containing the WhoAmISubResponse information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateWhoAmISubResponse(WhoAmISubResponseType whoamiSubResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R765
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     765,
                     @"[In WhoAmISubResponseType][WhoAmISubResponseType schema is:]
                     <xs:complexType name=""WhoAmISubResponseType"">
                       <xs:complexContent>
                         <xs:extension base=""tns:SubResponseType"">
                           <xs:sequence minOccurs=""0"" maxOccurs=""1"">
                              <xs:element name=""SubResponseData"" type=""tns:WhoAmISubResponseDataType""/>
                           </xs:sequence>
                         </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1316
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(WhoAmISubResponseType),
                     whoamiSubResponse.GetType(),
                     "MS-FSSHTTP",
                     1316,
                     @"[In WhoAmI Subrequest][The protocol client sends a WhoAmI SubRequest message, which is of type WhoAmISubRequestType] The protocol server responds with a WhoAmI SubResponse message, which is of type WhoAmISubResponseType as specified in section 2.3.1.22.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4692
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(WhoAmISubResponseType),
                     whoamiSubResponse.GetType(),
                     "MS-FSSHTTP",
                     4692,
                     @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: WhoAmISubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5746
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(WhoAmISubResponseType),
                     whoamiSubResponse.GetType(),
                     "MS-FSSHTTP",
                     5746,
                     @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: WhoAmISubResponseType.");

            ErrorCodeType errorCode;
            site.Assert.IsTrue(Enum.TryParse<ErrorCodeType>(whoamiSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", whoamiSubResponse.ErrorCode);
            if (errorCode == ErrorCodeType.Success)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R268
                site.CaptureRequirementIfIsNotNull(
                         whoamiSubResponse.SubResponseData,
                         "MS-FSSHTTP",
                         268,
                         @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""WhoAmI"".");
            }

            // Verify requirements related with its base type: SubResponseType
            ValidateSubResponseType(whoamiSubResponse as SubResponseType, site);

            // Verify requirements related with SubResponseDataType
            if (whoamiSubResponse.SubResponseData != null)
            {
                ValidateWhoAmISubResponseDataType(whoamiSubResponse.SubResponseData, site);
            }
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:67,代码来源:MsfsshttpWhoAmICapture.cs

示例8: ValidateCellSubResponse

        /// <summary>
        /// Capture requirements related with Cell Sub-request.
        /// </summary>
        /// <param name="cellSubResponse">Containing the CellSubResponse information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateCellSubResponse(CellSubResponseType cellSubResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R553
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     553,
                     @"[In CellSubResponseType][CellSubResponseType schema is:]
                     <xs:complexType name=""CellSubResponseType"">
                        <xs:complexContent>
                          <xs:extension base=""tns:SubResponseType"">
                            <xs:sequence>
                               <xs:element name=""SubResponseData"" type=""tns:CellSubResponseDataType"" minOccurs=""0"" maxOccurs=""1"" />
                               <xs:element name=""SubResponseStreamInvalid"" minOccurs=""0"" maxOccurs=""1"" />
                            </xs:sequence>
                          </xs:extension>
                        </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R951
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(CellSubResponseType),
                     cellSubResponse.GetType(),
                     "MS-FSSHTTP",
                     951,
                     @"[In Cell Subrequest][The protocol client sends a cell SubRequest message, which is of type CellSubRequestType,] The protocol server responds with a cell SubResponse message, which is of type CellSubResponseType as specified in section 2.3.1.4.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1687
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(CellSubResponseType),
                     cellSubResponse.GetType(),
                     "MS-FSSHTTP",
                     1687,
                     @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: CellSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R274
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(CellSubResponseType),
                     cellSubResponse.GetType(),
                     "MS-FSSHTTP",
                     274,
                     @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: CellSubResponseType.");

            ErrorCodeType errorCode;
            site.Assert.IsTrue(Enum.TryParse<ErrorCodeType>(cellSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", cellSubResponse.ErrorCode);

            if (cellSubResponse.ErrorCode != null)
            {
                ValidateCellRequestErrorCodeTypes(errorCode, site);
            }

            if (errorCode == ErrorCodeType.Success)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R263
                site.Log.Add(
                    LogEntryKind.Debug,
                    "For requirement MS-FSSHTTP_R263, the SubResponseData value should not be NULL when the cell sub-request succeeds, the actual SubResponseData value is: {0}",
                    cellSubResponse.SubResponseData != null ? cellSubResponse.SubResponseData.ToString() : "NULL");

                site.CaptureRequirementIfIsNotNull(
                         cellSubResponse.SubResponseData,
                         "MS-FSSHTTP",
                         263,
                         @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""Cell"".");
            }

            // Verify requirements related with its base type : SubResponseType
            ValidateSubResponseType(cellSubResponse as SubResponseType, site);

            // Verify requirements related with CellSubResponseDataType
            if (cellSubResponse.SubResponseData != null)
            {
                ValidateCellSubResponseDataType(cellSubResponse.SubResponseData, site);
            }
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:79,代码来源:MsfsshttpCellSubRequestCapture.cs


注:本文中的ITestSite.CaptureRequirementIfIsNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。