public void MSWEBSS_S05_TC02_GetObjectIdFromUrl_ValidListItemUrl()
        {
            this.Site.Assume.IsTrue(Common.IsRequirementEnabled(1032, this.Site), "The test case is executed only the property 'R1032Enabled' is true.");

            GetObjectIdFromUrlResponseGetObjectIdFromUrlResult getObjectIdFromUrlResult = Adapter.GetObjectIdFromUrl(Common.GetConfigurationPropertyValue("GetObjectIdFromUrl_ListItemUrl", this.Site));

            // If the product is Microsoft SharePoint Foundation 2010 and above, Verify MS-WEBSS requirement: MS-WEBSS_R1032 when invokes the operation "GetObjectIdFromUrl" successfully.
            Site.CaptureRequirement(
                1032,
                @"[In Appendix B: Product Behavior]  Implementation does support this[GetObjectIdFromUrl] operation.(<16>Microsoft SharePoint Foundation 2010 and above follow this behavior.)");

            #region Capture ListItem Related Requirement

            // Verify MS-WEBSS requirement: MS-WEBSS_R313
            // If the specified URL corresponds to an object on the site (2), use that object as input parameter.
            // the server can respond correctly.
            Site.CaptureRequirementIfIsNotNull(
                getObjectIdFromUrlResult,
                313,
                @"[In GetObjectIdFromUrl] If the specified URL corresponds to an object on the site, use that object.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R335
            string listItemId = SutAdapter.GetObjectId(Common.GetConfigurationPropertyValue("webSiteName", this.Site), "listItem");
            BaseTestSite.Assert.IsNotNull(listItemId, "This value of the list item should be non-empty");
            Site.CaptureRequirementIfAreEqual <string>(
                listItemId,
                getObjectIdFromUrlResult.ObjectId.ListItemId,
                335,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListItemId: If the object is a list item, the value of the attribute[ObjectId.ListItemId] MUST be the identifier of the list item.");

            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This operation obtains properties of the object referenced by the specified URL.
        /// </summary>
        /// <param name="objectUrl">The URL of the object to retrieve information.</param>
        /// <returns>The Object Id of GetObjectIdFromUrl.</returns>
        public GetObjectIdFromUrlResponseGetObjectIdFromUrlResult GetObjectIdFromUrl(string objectUrl)
        {
            GetObjectIdFromUrlResponseGetObjectIdFromUrlResult getObjectIdFromUrlResult = null;

            getObjectIdFromUrlResult = this.service.GetObjectIdFromUrl(objectUrl);
            this.ValidateGetObjectIdFromUrl(getObjectIdFromUrlResult);
            this.CaptureTransportRelatedRequirements();

            return(getObjectIdFromUrlResult);
        }
        public void MSWEBSS_S05_TC03_GetObjectIdFromUrl_NoListOrListItemUrl()
        {
            this.Site.Assume.IsTrue(Common.IsRequirementEnabled(1032, this.Site), "The test case is executed only when the property 'R1032Enabled' is true.");

            GetObjectIdFromUrlResponseGetObjectIdFromUrlResult getObjectIdFromUrlResult = Adapter.GetObjectIdFromUrl(Common.GetConfigurationPropertyValue("GetObjectIdFromUrl_NoListRelatedUrl", this.Site));

            Site.CaptureRequirementIfIsFalse(
                getObjectIdFromUrlResult.ObjectId.ListServerTemplateSpecified,
                331,
                @"[In GetObjectIdFromUrlResponse] Otherwise[If the object is not a list and list item, the value of the attribute MUST be one of the list template types as specified in [MS-WSSFO2] section 2.2.3.12 [the list template types's value are -1,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,130,140,150,200,201,202,204,207,210,211,212,301,302,303,402,403,404,405,420,421,499,1100,1200,1220,1221].], the attribute MUST NOT be present.");

            Site.CaptureRequirementIfIsFalse(
                getObjectIdFromUrlResult.ObjectId.ListBaseTypeSpecified,
                333,
                @"[In GetObjectIdFromUrlResponse] Otherwise[If the object is a list and list item], the attribute MUST NOT be present.");

            Site.CaptureRequirementIfAreEqual <string>(
                string.Empty,
                getObjectIdFromUrlResult.ObjectId.ListId,
                329,
                @"[In GetObjectIdFromUrlResponse] Otherwise[If the object is not a list and list item, the value of the attribute MUST be the list identifier. ], the value of this[ObjectId.ListId] attribute MUST be an empty string.");
        }
        public void MSWEBSS_S05_TC01_GetObjectIdFromUrl_ValidListUrl()
        {
            this.Site.Assume.IsTrue(Common.IsRequirementEnabled(1032, this.Site), "The test case is executed only when the property 'R1032Enabled' is true.");

            GetObjectIdFromUrlResponseGetObjectIdFromUrlResult getObjectIdFromUrlResult     = Adapter.GetObjectIdFromUrl(Common.GetConfigurationPropertyValue("GetObjectIdFromUrl_ListUrl", this.Site));
            GetObjectIdFromUrlResponseGetObjectIdFromUrlResult getObjectItemIdFromUrlResult = Adapter.GetObjectIdFromUrl(Common.GetConfigurationPropertyValue("GetObjectIdFromUrl_ListItemUrl", this.Site));

            // If the product is Microsoft SharePoint Foundation 2010 and above, Verify MS-WEBSS requirement: MS-WEBSS_R1032 when invokes the operation "GetObjectIdFromUrl" successfully.
            Site.CaptureRequirement(
                1032,
                @"[In Appendix B: Product Behavior]  Implementation does support this[GetObjectIdFromUrl] operation.(<16>Microsoft SharePoint Foundation 2010 and above follow this behavior.)");

            #region Capture List Related Requirement

            // Verify MS-WEBSS requirement: MS-WEBSS_R328 MS-WEBSS_R328001
            string webSiteName = SutAdapter.GetObjectId(Common.GetConfigurationPropertyValue("webSiteName", this.Site), "list");
            Site.Assert.IsNotNull(webSiteName, "This value of the list id should be non-empty");
            string exceptedId = "{" + webSiteName + "}";

            Site.CaptureRequirementIfAreEqual <string>(
                exceptedId,
                getObjectIdFromUrlResult.ObjectId.ListId.ToString(),
                328,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListId: If the object is a list, the value of the attribute MUST be the list identifier.");

            Site.CaptureRequirementIfAreEqual <string>(
                exceptedId,
                getObjectItemIdFromUrlResult.ObjectId.ListId.ToString(),
                328001,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListId: If the object is a list item, the value of the attribute MUST be the list identifier.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R1043, MS-WEBSS_R1045001001
            // The type of List Server Template, the values are gotten according to [MS-WSSFO] section 2.2.3.12.
            string listServerTemplateValues = "-1,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,130,140,150,200,201,202,204,207,210,211,212,301,302,303,1100,1200";
            bool   isListServerTemplateSpecifiedInMswssfo     = listServerTemplateValues.Contains(getObjectIdFromUrlResult.ObjectId.ListServerTemplate.ToString());
            bool   isListItemServerTemplateSpecifiedInMswssfo = listServerTemplateValues.Contains(getObjectItemIdFromUrlResult.ObjectId.ListServerTemplate.ToString());

            Site.CaptureRequirementIfIsTrue(
                isListServerTemplateSpecifiedInMswssfo,
                1043,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListServerTemplate: If the object is a list, the value of the attribute MUST be one of the list template types as specified in [MS-WSSFO2] section 2.2.3.12 [the value of the list template type is 100].");

            Site.CaptureRequirementIfIsTrue(
                isListServerTemplateSpecifiedInMswssfo,
                1045001001,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListServerTemplate: If the object is a list item, the value of the attribute MUST be one of the list template types as specified in [MS-WSSFO2] section 2.2.3.12 [the value of the list template type is 100].");

            // The values of List Base Type, the values are gotten according to [MS-WSSFO] section 2.2.3.11.
            string listBaseTypeValues = "0,1,3,4,5";
            bool   isListBaseTypeSpecifiedInMswssfo     = listBaseTypeValues.Contains(getObjectIdFromUrlResult.ObjectId.ListBaseType.ToString());
            bool   isListItemBaseTypeSpecifiedInMswssfo = listBaseTypeValues.Contains(getObjectItemIdFromUrlResult.ObjectId.ListBaseType.ToString());

            // Verify MS-WEBSS requirement: MS-WEBSS_R1044
            Site.CaptureRequirementIfIsTrue(
                isListBaseTypeSpecifiedInMswssfo,
                1044,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListBaseType: If the object is a list, the value of the attribute MUST be one of the List Base Types as specified in [MS-WSSFO2] section 2.2.3.11 [the value of the List Base Type is 1].");

            // Verify MS-WEBSS requirement: MS-WEBSS_R1046001001
            Site.CaptureRequirementIfIsTrue(
                isListItemBaseTypeSpecifiedInMswssfo,
                1046001001,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListBaseType: If the object is a list item, the value of the attribute MUST be one of the List Base Types as specified in [MS-WSSFO2] section 2.2.3.11 [the value of the List Base Type is 1].");

            bool isVerifiedR334 = false;
            if (getObjectIdFromUrlResult.ObjectId.ListItem.ToLower().Equals("false", StringComparison.OrdinalIgnoreCase))
            {
                isVerifiedR334 = true;
                Site.Assert.AreEqual("false", getObjectIdFromUrlResult.ObjectId.ListItem.ToLower(), "It is expected to get false, since this is not a list item.");
            }

            // Verify MS-WEBSS requirement: MS-WEBSS_R334
            Site.CaptureRequirementIfIsTrue(
                isVerifiedR334,
                334,
                @"[In GetObjectIdFromUrlResponse] ObjectId.ListItem: Specifies whether the object is a list item.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R336
            bool isVerifiedR336 = false;
            if (getObjectIdFromUrlResult.ObjectId.ListItemId == null)
            {
                isVerifiedR336 = true;
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifiedR336,
                336,
                @"[In GetObjectIdFromUrlResponse] Otherwise[If the object is not a list item], the attribute MUST NOT be present.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R337
            bool isVerifiedR337 = false;
            if (getObjectIdFromUrlResult.ObjectId.File.ToLower().Equals("true", StringComparison.OrdinalIgnoreCase))
            {
                isVerifiedR337 = true;
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifiedR337,
                337,
                @"[In GetObjectIdFromUrlResponse] ObjectId.File: Specifies whether the object is a file.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R338
            bool isVerifiedR338 = false;
            if (getObjectIdFromUrlResult.ObjectId.Folder.ToLower().Equals("false", StringComparison.OrdinalIgnoreCase))
            {
                isVerifiedR338 = true;
                Site.Assert.AreEqual("false", getObjectIdFromUrlResult.ObjectId.Folder.ToLower(), "It is expected to get false, since this is not a folder.");
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifiedR338,
                338,
                @"[In GetObjectIdFromUrlResponse] ObjectId.Folder: Specifies whether the object is a folder.");

            // Verify MS-WEBSS requirement: MS-WEBSS_R719
            bool     isVerifiedR719  = false;
            string   alternateUrl    = getObjectIdFromUrlResult.ObjectId.AlternateUrls;
            string[] urlSplit        = alternateUrl.Split(',');
            int      urlNum          = urlSplit.Length;
            string   sutComputerName = Common.GetConfigurationPropertyValue("SutComputerName", this.Site);
            string   transportType   = Common.GetConfigurationPropertyValue("TransportType", this.Site);
            for (int i = 0; i < urlNum; i++)
            {
                if (urlSplit[i] == transportType.ToLower() + "://" + sutComputerName.ToLower() + "/")
                {
                    isVerifiedR719 = true;
                    break;
                }
            }

            Site.CaptureRequirementIfIsTrue(
                isVerifiedR719,
                719,
                @"[In GetObjectIdFromUrlResponse] ObjectId. AlternateUrls: Alternate URLs are a comma delimited list of other possible URLs for the object.");

            #endregion
        }
        /// <summary>
        /// Capture GetObjectIdFromUrl operation related requirements.
        /// </summary>
        /// <param name="getObjectIdFromUrlResult">The Result of GetObjectIdFromUrl.</param>
        private void ValidateGetObjectIdFromUrl(GetObjectIdFromUrlResponseGetObjectIdFromUrlResult getObjectIdFromUrlResult)
        {
            if (!string.IsNullOrEmpty(getObjectIdFromUrlResult.ObjectId.ListId))
            {
                // Verify MS-WEBSS requirement: MS-WEBSS_R311
                // The operation is called successfully with the right response returned,
                // so the requirement can be captured.
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                    311,
                    @"[In GetObjectIdFromUrl] This[GetObjectIdFromUrl] operation is defined as follows:
<wsdl:operation name=""GetObjectIdFromUrl"">
    <wsdl:input message=""tns:GetObjectIdFromUrlSoapIn"" />
    <wsdl:output message=""tns:GetObjectIdFromUrlSoapOut"" />
</wsdl:operation>");

                // Verify MS-WEBSS requirement: MS-WEBSS_R312
                // The operation is called successfully with the right response returned,
                // so the requirement can be captured.
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                    312,
                    @"[In GetObjectIdFromUrl] [The protocol client sends a GetObjectIdFromUrlSoapIn request message] the protocol server responds with a GetObjectIdFromUrlSoapOut response message as follows:");

                // Verify MS-WEBSS requirement: MS-WEBSS_R320
                bool hasResponse = AdapterHelper.ElementExists(SchemaValidation.LastRawResponseXml, "GetObjectIdFromUrlResponse");
                Site.CaptureRequirementIfIsTrue(
                    hasResponse,
                    320,
                    @"[In GetObjectIdFromUrlSoapOut] The SOAP body contains a GetObjectIdFromUrlResponse element.");

                // Verify MS-WEBSS requirement: MS-WEBSS_R325
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                    325,
                    @"[In GetObjectIdFromUrlResponse] This element represents the result data of a GetObjectIdFromUrl operation. This element is defined as follows:
<s:element name=""GetObjectIdFromUrlResponse"">
  <s:complexType>
    <s:sequence>
      <s:element name=""GetObjectIdFromUrlResult"" minOccurs=""1"" maxOccurs=""1"">
        <s:complexType mixed=""true"">
          <s:sequence>
            <s:element name=""ObjectId"" minOccurs=""1"" maxOccurs=""1"">
              <s:complexType>
                <s:attribute name=""ListId"" type=""core:UniqueIdentifierWithBracesOrEmpty"" />
                <s:attribute name=""ListServerTemplate"">
                  <s:simpleType>
                    <s:restriction base=""s:int"">
                      <s:enumeration value=""0""/>
                      <s:enumeration value=""100""/>
                      <s:enumeration value=""101""/>
                      <s:enumeration value=""102""/>
                      <s:enumeration value=""103""/>
                      <s:enumeration value=""104""/>
                      <s:enumeration value=""105""/>
                      <s:enumeration value=""106""/>
                      <s:enumeration value=""107""/>
                      <s:enumeration value=""108""/>
                      <s:enumeration value=""109""/>
                      <s:enumeration value=""110""/>
                      <s:enumeration value=""111""/>
                      <s:enumeration value=""112""/>
                      <s:enumeration value=""113""/>
                      <s:enumeration value=""114""/>
                      <s:enumeration value=""115""/>
                      <s:enumeration value=""116""/>
                      <s:enumeration value=""117""/>
                      <s:enumeration value=""118""/>
                      <s:enumeration value=""119""/>
                      <s:enumeration value=""120""/>
                      <s:enumeration value=""121""/>
                      <s:enumeration value=""122""/>
                      <s:enumeration value=""123""/>
                      <s:enumeration value=""130""/>
                      <s:enumeration value=""140""/>
                      <s:enumeration value=""150""/>
                      <s:enumeration value=""200""/>
                      <s:enumeration value=""201""/>
                      <s:enumeration value=""202""/>
                      <s:enumeration value=""204""/>
                      <s:enumeration value=""207""/>
                      <s:enumeration value=""210""/>
                      <s:enumeration value=""211""/>
                      <s:enumeration value=""212""/>
                      <s:enumeration value=""301""/>
                      <s:enumeration value=""302""/>
                      <s:enumeration value=""303""/>
                      <s:enumeration value=""402""/>
                      <s:enumeration value=""403""/>
                      <s:enumeration value=""404""/>
                      <s:enumeration value=""405""/>
                      <s:enumeration value=""420""/>
                      <s:enumeration value=""421""/>
                      <s:enumeration value=""499""/>
                      <s:enumeration value=""851""/>
                      <s:enumeration value=""1100""/>
                      <s:enumeration value=""1200""/>
                      <s:enumeration value=""1220""/>
                      <s:enumeration value=""1221""/>
                    </s:restriction>
                  </s:simpleType>
                </s:attribute>
                <s:attribute name=""ListBaseType"">
                  <s:simpleType>
                    <s:restriction base=""s:int"">
                      <s:enumeration value=""0""/>
                      <s:enumeration value=""1""/>
                      <s:enumeration value=""2""/>
                      <s:enumeration value=""3""/>
                      <s:enumeration value=""4""/>
                      <s:enumeration value=""5""/>
                    </s:restriction>
                  </s:simpleType>
                </s:attribute>
                <s:attribute name=""ListItem"" type=""core:TRUEFALSE"" />
                <s:attribute name=""ListItemId"" type=""s:string"" />
                <s:attribute name=""File"" type=""core:TRUEFALSE"" />
                <s:attribute name=""Folder"" type=""core:TRUEFALSE"" />
                <s:attribute name=""AlternateUrls"" type=""s:string"" />
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:sequence>
  </s:complexType>
</s:element>");

                // Verify MS-WEBSS requirement: MS-WEBSS_R326
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                326,
                @"[In GetObjectIdFromUrlResponse] GetObjectIdFromUrlResult: If no error conditions as specified earlier cause the protocol server to return a SOAP exception, a GetObjectIdFromUrlResult MUST be returned.");

                // Verify MS-WEBSS requirement: MS-WEBSS_R327
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                327,
                @"[In GetObjectIdFromUrlResponse] ObjectId: The container element for the object properties.");

                // Verify MS-WEBSS requirement: MS-WEBSS_R1045
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                    1045,
                    @"[In GetObjectIdFromUrlResponse] ObjectId.ListServerTemplate: If the object is a list, the value of the attribute MUST be one of the list template types as specified in [MS-WSSFO2] section 2.2.3.12 [the values of the list template types are -1,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,130,140,150,200,201,202,204,207,210,211,212,301,302,303,402,403,404,405,420,421,499,1100,1200,1220,1221].");

                // Verify MS-WEBSS requirement: MS-WEBSS_R1046
                Site.CaptureRequirementIfAreEqual<ValidationResult>(
                    ValidationResult.Success,
                    SchemaValidation.ValidationResult,
                    1046,
                    @"[In GetObjectIdFromUrlResponse] ObjectId.ListBaseType: If the object is a list, the value of the attribute MUST be one of the List Base Types as specified in [MS-WSSFO2] section 2.2.3.11 [the values of the List Base Types are 0,1,3,4,5].");
            }
        }