Ejemplo n.º 1
0
        /// <summary>
        /// This operation is used to get a list of the titles and URLs of all sites in the site collection.
        /// </summary>
        /// <returns>The result of GetAllSubWebCollection.</returns>
        public GetAllSubWebCollectionResponseGetAllSubWebCollectionResult GetAllSubWebCollection()
        {
            GetAllSubWebCollectionResponseGetAllSubWebCollectionResult result = new GetAllSubWebCollectionResponseGetAllSubWebCollectionResult();

            try
            {
                result = this.service.GetAllSubWebCollection();

                // Capture requirements of WebDefinition complex type.
                if (result.Webs.Length > 0)
                {
                    this.ValidateWebDefinitionForSubWebCollection();
                }

                // Capture requirements of GetAllSubWebCollection operation.
                this.ValidateGetAllSubWebCollection(result);
                this.CaptureTransportRelatedRequirements();

                return(result);
            }
            catch (SoapException exp)
            {
                // Capture requirements of detail complex type.
                this.ValidateDetail(exp.Detail);
                this.CaptureTransportRelatedRequirements();

                throw;
            }
        }
        /// <summary>
        /// This method is used to capture requirements of GetAllSubWebCollection operation.
        /// </summary>
        /// <param name="getAllSubWebCollectionResult">The result of the operation.</param>
        private void ValidateGetAllSubWebCollection(
            GetAllSubWebCollectionResponseGetAllSubWebCollectionResult getAllSubWebCollectionResult)
        {
            // Proxy handles operation's SoapIn and SoapOut, if the server didn't respond the SoapOut message for the operation, Proxy will fail. 
            // Proxy didn't fail now, that indicates server responds corresponding SoapOut message for the operation.So the requirement be captured.
            // Verify MS-WEBSS requirement: MS-WEBSS_R142
            Site.CaptureRequirementIfAreEqual<ValidationResult>(
                ValidationResult.Success,
                SchemaValidation.ValidationResult,
                142,
                @"[In GetAllSubWebCollection] This operation[GetAllSubWebCollection] is defined as follows:
<wsdl:operation name=""GetAllSubWebCollection"">
    <wsdl:input message=""tns:GetAllSubWebCollectionSoapIn"" />
    <wsdl:output message=""tns:GetAllSubWebCollectionSoapOut"" />
</wsdl:operation>");

            // Verify MS-WEBSS requirement: MS-WEBSS_R143
            Site.CaptureRequirementIfAreEqual<ValidationResult>(
                ValidationResult.Success,
                SchemaValidation.ValidationResult,
                143,
                @"[In GetAllSubWebCollection] [The protocol client sends a GetAllSubWebCollectionSoapIn request message] The protocol server responds with a GetAllSubWebCollectionSoapOut response message.");

            // Ensure the SOAP result is returned successfully.
            Site.Assume.IsNotNull(
                getAllSubWebCollectionResult,
                "The result of GetAllSubWebCollection operation must not be null.");

            // COMMENT: There is at least one more site besides the one we added in the 
            // TestInitialize in the server. If the response contains at least 2 sites and one of them 
            // has the expected Title and the expected URL, then the following requirement can be 
            // captured.
            bool isVerifiedR148 = false;
            string subSiteUrl = Common.GetConfigurationPropertyValue("SubSiteUrl", this.Site);

            if (getAllSubWebCollectionResult.Webs.Length > 1)
            {
                foreach (WebDefinition w in getAllSubWebCollectionResult.Webs)
                {
                    string testSiteTitle = Common.GetConfigurationPropertyValue("TestSiteTitle", this.Site);
                    if (w.Title.Equals(testSiteTitle, System.StringComparison.OrdinalIgnoreCase) &&
                        w.Url.Equals(subSiteUrl, System.StringComparison.OrdinalIgnoreCase))
                    {
                        isVerifiedR148 = true;
                        break;
                    }
                }
            }

            // Verify MS-WEBSS requirement: MS-WEBSS_R148
            Site.CaptureRequirementIfIsTrue(
                isVerifiedR148,
                148,
                @"[In GetAllSubWebCollectionSoapOut] This message[GetAllSubWebCollectionSoapOut] returns the title and URL of all sites (2) in the site collection.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R150
            Site.CaptureRequirementIfIsTrue(
                this.HasElement(SchemaValidation.LastRawResponseXml, "GetAllSubWebCollectionResponse"),
                150,
                @"[In GetAllSubWebCollectionSoapOut] The SOAP body contains a GetAllSubWebCollectionResponse element.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R152
            Site.CaptureRequirementIfAreEqual<ValidationResult>(
                ValidationResult.Success,
                SchemaValidation.ValidationResult,
                152,
                @"[In GetAllSubWebCollectionResponse] The SOAP body contains a GetAllSubWebCollectionResponse element, which has the following definition:
<s:element name=""GetAllSubWebCollectionResponse"">
  <s:complexType>
    <s:sequence>
      <s:element name=""GetAllSubWebCollectionResult"" minOccurs=""1"" maxOccurs=""1"" >
        <s:complexType mixed=""true"">
          <s:sequence>
            <s:element name=""Webs"">
              <s:complexType>
                <s:sequence>
                  <s:element name=""Web"" type=""tns:WebDefinition"" minOccurs=""1"" maxOccurs=""unbounded"" />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:sequence>
  </s:complexType>
</s:element>");

            // Verify MS-WEBSS requirement: MS-WEBSS_R153
            Site.CaptureRequirementIfAreEqual<ValidationResult>(
                ValidationResult.Success,
                SchemaValidation.ValidationResult,
                153,
                @"[In GetAllSubWebCollectionResponse] GetAllSubWebCollectionResult: Contains a single Webs element.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R154
            Site.CaptureRequirementIfAreEqual<ValidationResult>(
                ValidationResult.Success,
                SchemaValidation.ValidationResult,
                154,
                @"[In GetAllSubWebCollectionResponse] Webs: This element contains one or more Web elements.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R155
            Site.CaptureRequirementIfAreEqual<ValidationResult>(
                ValidationResult.Success,
                SchemaValidation.ValidationResult,
                155,
                @"[In GetAllSubWebCollectionResponse] Web: This element is of type WebDefinition, as specified in section 2.2.4.2.");

            // COMMENT: There is at least one more site besides the one we added in the 
            // TestInitialize in the server. If the response contains at least 2 sites and one of them 
            // has the expected Title and the expected URL, then the following requirement can be 
            // captured.
            bool isVerifiedR158 = false;
            if (getAllSubWebCollectionResult.Webs.Length > 1)
            {
                foreach (WebDefinition w in getAllSubWebCollectionResult.Webs)
                {
                    if (w.Title.Equals(Common.GetConfigurationPropertyValue("TestSiteTitle", this.Site), System.StringComparison.OrdinalIgnoreCase)
                        && w.Url.Equals(subSiteUrl, System.StringComparison.OrdinalIgnoreCase))
                    {
                        isVerifiedR158 = true;
                        break;
                    }
                }
            }

            // Verify MS-WEBSS requirement: MS-WEBSS_R158
            Site.CaptureRequirementIfIsTrue(
                isVerifiedR158,
                158,
                @"[In GetAllSubWebCollectionResponse] The GetAllSubWebCollectionResult element MUST contain one child Webs element, which MUST contain a sequence of one or more child Web elements, one for each site in the current site collection.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R159
            // COMMENT: There is at least one more site besides the one we added in the 
            // TestInitialize in the server. If the response contains at least 2 sites and one of them 
            // has the expected Title, then the following requirement can be captured.
            bool isVerifiedR159 = false;
            if (getAllSubWebCollectionResult.Webs.Length > 1)
            {
                foreach (WebDefinition w in getAllSubWebCollectionResult.Webs)
                {
                    if (w.Title.Equals(Common.GetConfigurationPropertyValue("TestSiteTitle", this.Site), System.StringComparison.OrdinalIgnoreCase))
                    {
                        isVerifiedR159 = true;
                        break;
                    }
                }
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifiedR159,
                159,
                @"[In GetAllSubWebCollectionResponse] Each Web element MUST specify the title  of one site in the collection.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R713
            // COMMENT: There is at least one more site besides the one we added in the 
            // TestInitialize in the server. If the response contains at least 2 sites and one of them 
            // has the expected URL, then the following requirement can be captured.
            bool isVerifiedR713 = false;
            if (getAllSubWebCollectionResult.Webs.Length > 1)
            {
                foreach (WebDefinition w in getAllSubWebCollectionResult.Webs)
                {
                    if (w.Url.Equals(subSiteUrl, System.StringComparison.OrdinalIgnoreCase))
                    {
                        isVerifiedR713 = true;
                        break;
                    }
                }
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifiedR713,
                713,
                @"[In GetAllSubWebCollectionResponse] Each Web element MUST specify the URL of one site in the collection.");
        }
Ejemplo n.º 3
0
        public void MSWEBSS_S09_TC08_GetAllSubWebCollection_Succeed()
        {
            GetAllSubWebCollectionResponseGetAllSubWebCollectionResult getAllSubWebResult = Adapter.GetAllSubWebCollection();

            this.Site.Assert.IsNotNull(getAllSubWebResult, "GetAllSubWebCollection operation should succeed.");
        }
        /// <summary>
        /// This operation is used to get a list of the titles and URLs of all sites in the site collection.
        /// </summary>
        /// <returns>The result of GetAllSubWebCollection.</returns>
        public GetAllSubWebCollectionResponseGetAllSubWebCollectionResult GetAllSubWebCollection()
        {
            GetAllSubWebCollectionResponseGetAllSubWebCollectionResult result = new GetAllSubWebCollectionResponseGetAllSubWebCollectionResult();

            try
            {
                result = this.service.GetAllSubWebCollection();

                // Capture requirements of WebDefinition complex type.
                if (result.Webs.Length > 0)
                {
                    this.ValidateWebDefinitionForSubWebCollection();
                }

                // Capture requirements of GetAllSubWebCollection operation.
                this.ValidateGetAllSubWebCollection(result);
                this.CaptureTransportRelatedRequirements();

                return result;
            }
            catch (SoapException exp)
            {
                // Capture requirements of detail complex type.
                this.ValidateDetail(exp.Detail);
                this.CaptureTransportRelatedRequirements();

                throw;
            }
        }