Microsoft.Protocols.TestSuites.MS_SITESS.MS_SITESSAdapter.VerifyGetUpdatedFormDigestInformation C# (CSharp) Méthode

VerifyGetUpdatedFormDigestInformation() private méthode

Verify GetUpdatedFormDigest related requirements.
private VerifyGetUpdatedFormDigestInformation ( FormDigestInformation getUpdatedFormDigestInfoResult ) : void
getUpdatedFormDigestInfoResult FormDigestInformation The result of GetUpdatedFormDigestInformation.
Résultat void
        private void VerifyGetUpdatedFormDigestInformation(FormDigestInformation getUpdatedFormDigestInfoResult)
        {
            Site.Log.Add(LogEntryKind.Comment, "Verify common requirements in GetUpdatedFormDigestInformation operation.");
            this.VerifyCommonReqs();

            // If TimeoutSeconds>0 and DigestValue is not empty, then we can be sure that the server returns the two variables.
            bool isRS215Satisfied = getUpdatedFormDigestInfoResult.TimeoutSeconds > 0
                && !string.IsNullOrEmpty(getUpdatedFormDigestInfoResult.DigestValue);

            // If TimeoutSeconds>0 and DigestValue is not empty, R215 can be verified.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R215, the TimeoutSeconds of getUpdatedFormDigestInfoResult is {0}, the DigestValue of getUpdatedFormDigestInfoResult is {1}", getUpdatedFormDigestInfoResult.TimeoutSeconds, getUpdatedFormDigestInfoResult.DigestValue);

            // Verify MS-SITESS requirement: MS-SITESS_R215
            Site.CaptureRequirementIfIsTrue(
                isRS215Satisfied,
                215,
                @"[In GetUpdatedFormDigestInformation] In this operation [GetUpdatedFormDigestInformation], the protocol server MUST return the security validation token's expiration time in addition to the security validation token.");

            // When code can run to this line, it indicates the soap out message for this operation is received, else the operation will throw exception above.
            // So this operation's description is consistent with server.
            Site.CaptureRequirement(
                216,
                @"[In GetUpdatedFormDigestInformation] [The GetUpdatedFormDigestInformation operation is defined as:] <wsdl:operation name=""GetUpdatedFormDigestInformation"">
              <wsdl:input message=""tns:GetUpdatedFormDigestInformationSoapIn"" />
              <wsdl:output message=""tns:GetUpdatedFormDigestInformationSoapOut"" />
              </wsdl:operation>");

            bool isSchemaRight = SchemaValidation.XmlValidationErrors.Count == 0 && SchemaValidation.XmlValidationWarnings.Count == 0;

            // If we can get the element name of GetUpdatedFormDigestInformationResponse, then we can get the element.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R224");

            // Verify MS-SITESS requirement: MS-SITESS_R224
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                224,
                @"[In GetUpdatedFormDigestInformationSoapOut] The SOAP body contains a GetUpdatedFormDigestInformationResponse element.");

            // If the response contains the element GetUpdatedFormDigestInformationResult,then we can be sure the format of GetUpdatedFormDigestInformationResponse.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R228");

            // Verify MS-SITESS requirement: MS-SITESS_R228
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                228,
                @"[In GetUpdatedFormDigestInformationResponse] [The GetUpdatedFormDigestInformationResponse element is defined as:] <s:element name=""GetUpdatedFormDigestInformationResponse"">
              <s:complexType>
              <s:sequence>
              <s:element minOccurs=""1"" maxOccurs=""1""
              name=""GetUpdatedFormDigestInformationResult""
              type=""tns:FormDigestInformation"" />
              </s:sequence>
              </s:complexType>
              </s:element>");

            // When the variable isSchemaRight is true, it exposes that the message's format described in the Open Specification is consistent with server. So we can verify R218.
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                218,
                @"[In GetUpdatedFormDigestInformation] [The protocol client sends a GetUpdatedFormDigestInformationSoapIn request message and] the protocol server responds with a GetUpdatedFormDigestInformationSoapOut response message.");

            // When the variable isSchemaRight is true, it exposes that the message's format described in the Open Specification is consistent with server. So we can verify R231.
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                231,
                @"[In FormDigestInformation] [The FormDigestInformation complex type is defined as:] <s:complexType name=""FormDigestInformation"">
  <s:sequence>
    <s:element minOccurs=""0"" maxOccurs=""1"" name=""DigestValue"" type=""s:string"" /> 
    <s:element minOccurs=""1"" maxOccurs=""1"" name=""TimeoutSeconds"" type=""s:int"" /> 
    <s:element minOccurs=""0"" maxOccurs=""1"" name=""WebFullUrl"" type=""s:string"" />
    <s:element minOccurs=""0"" maxOccurs=""1"" name=""LibraryVersion"" type=""s:string"" />
    <s:element minOccurs=""0"" maxOccurs=""1"" name=""SupportedSchemaVersions"" type=""s:string"" />
  </s:sequence>
</s:complexType>");

            // If the library version is right, MS-CSOM_R1 can be captured.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-CSOM_R1, the LibraryVersion of getUpdatedFormDigestInfoResult is {0}", getUpdatedFormDigestInfoResult.LibraryVersion);

            // Verify MS-SITESS requirement: MS-CSOM_R1
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                "MS-CSOM",
                1,
                @"[In VersionStringType] [The VersionStringType is defined as:] <xs:simpleType name=""VersionStringType"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"">
  <xs:restriction base=""xs:string"">
    <xs:pattern value=""[0-9]{1,8}\.[0-9]{1,8}\.[0-9]{1,8}\.[0-9]{1,8}""/>
  </xs:restriction>
</xs:simpleType>");

            // If the SupportedSchemaVersions is comma-separated list of ""14.0.0.0"" or ""15.0.0.0"", MS-CSOM_R2 can be captured.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-CSOM_R2", getUpdatedFormDigestInfoResult.SupportedSchemaVersions);

            bool isVerifyR2 = true;

            char[] separator = new char[] { ',' };
            string[] splitResult = { };
            splitResult = getUpdatedFormDigestInfoResult.SupportedSchemaVersions.Split(separator);
            for (int i = 0; i < splitResult.Length; i++)
            {
                if (splitResult[i] != "14.0.0.0" && splitResult[i] != "15.0.0.0")
                {
                    isVerifyR2 = false;
                    break;
                }
            }

            // Verify MS-SITESS requirement: MS-CSOM_R2
            Site.CaptureRequirementIfIsTrue(
                isVerifyR2,
                "MS-CSOM",
                2,
                @"[In Attributes] [SchemaVersion:] This value MUST be ""14.0.0.0"" or ""15.0.0.0"".");
        }