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

VerifyGetSite() private méthode

Verify GetSite related requirements.
private VerifyGetSite ( string getSiteResult ) : void
getSiteResult string The result of GetSite.
Résultat void
        private void VerifyGetSite(string getSiteResult)
        {
            Site.Log.Add(LogEntryKind.Comment, "Verify common requirements in GetSite operation.");
            this.VerifyCommonReqs();

            // 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(
                120,
                @"[In GetSite] [The GetSite operation is defined as:] <wsdl:operation name=""GetSite"">
              <wsdl:input message=""tns:GetSiteSoapIn"" />
              <wsdl:output message=""tns:GetSiteSoapOut"" />
              </wsdl:operation>");
            bool isSchemaRight = SchemaValidation.XmlValidationErrors.Count == 0 && SchemaValidation.XmlValidationWarnings.Count == 0;

            // 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 R122.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R122");

            // Verify MS-SITESS requirement: MS-SITESS_R122
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                122,
                @"[In GetSite] [The client sends a GetSiteSoapIn request message and] the server responds with a GetSiteSoapOut 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 R128.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R128");

            // Verify MS-SITESS requirement: MS-SITESS_R128
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                128,
                @"[In GetSiteSoapOut] The SOAP body contains a GetSiteResponse 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 R134.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R134");

            // Verify MS-SITESS requirement: MS-SITESS_R134
            Site.CaptureRequirementIfIsTrue(
                isSchemaRight,
                134,
                @"[In GetSiteResponse] [The GetSiteResponse element is defined as:] <s:element name=""GetSiteResponse"">
              <s:complexType>
              <s:sequence>
              <s:element minOccurs=""0"" maxOccurs=""1"" name=""GetSiteResult""
              type=""s:string"" />
              </s:sequence>
              </s:complexType>
              </s:element>");

            // Specifies whether the format of GetSiteResult is consistent with "<Site Url=""<Url>"" Id=""<Id>"" UserCodeEnabled=""<UserCodeEnabled>".
            string getSiteResultSchema = @"<s:schema xmlns:s=""http://www.w3.org/2001/XMLSchema"">
<s:element name=""Site"">
<s:complexType>
<s:attribute name=""Url"" type=""s:string"" use=""required""/>
<s:attribute name=""Id"" type=""s:string"" use=""required""/>
<s:attribute name=""UserCodeEnabled"" type=""s:string"" use=""required""/>
</s:complexType>
</s:element>
</s:schema>";

            AdapterHelper.MessageValidation(getSiteResult, getSiteResultSchema);

            if (!string.IsNullOrEmpty(getSiteResult))
            {
                bool isGetSiteResuletSchemaRight = AdapterHelper.ValidationInfo.Count == 0;

                // If the Schema of GetSiteResult element is right, R136 can be captured.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R136, the count of ValidationInfos is {0}", AdapterHelper.ValidationInfo.Count);

                // Verify MS-SITESS requirement: MS-SITESS_R136
                Site.CaptureRequirementIfIsTrue(
                    isGetSiteResuletSchemaRight,
                    136,
                    @"[In GetSiteResponse] [GetSiteResult:] It is in the following form: <Site Url=UrlString Id=IdString UserCodeEnabled=UserCodeEnabledString />");

                // Deserialize the returned string to a Site object.
                Site result;
                result = AdapterHelper.SiteResultDeserialize(getSiteResult);

                // Specifies whether the Url contained in GetSiteResult is the absolute URL of the site collection.
                string expectSiteUrl = Common.GetConfigurationPropertyValue(Constants.SiteCollectionUrl, this.Site).TrimEnd('/');
                string actualSiteUrl = result.Url.TrimEnd('/');
                bool isSiteUrl = expectSiteUrl.Equals(actualSiteUrl, StringComparison.CurrentCultureIgnoreCase);

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R367, the actual SiteUrl is {0}", actualSiteUrl);

                // Verify MS-SITESS requirement: MS-SITESS_R367
                Site.CaptureRequirementIfIsTrue(
                    isSiteUrl,
                    367,
                    @"[In GetSiteResponse] [GetSiteResult:] Where UrlString is a quoted string that is the absolute URL of the site collection.");
            }
        }