Beispiel #1
0
        /// <summary>
        /// Delete the specified list in the base site.
        /// </summary>
        /// <param name="listName">The name of list which will be deleted.</param>
        /// <param name="baseUrl">The site URL for connecting with the specified Document Workspace site.</param>
        /// <returns>A Boolean indicates whether the operation is executed successfully,
        /// TRUE means the list is deleted, FALSE means the list does not exist.</returns>
        public bool DeleteList(string listName, string baseUrl)
        {
            this.RedirectBaseUrl(baseUrl);

            GetListCollectionResponseGetListCollectionResult getListResult = this.listsService.GetListCollection();

            // Check whether the specified list already exists in site collection.
            bool listIsExit = false;

            foreach (ListDefinitionCT list in getListResult.Lists)
            {
                string title = list.Title;
                if (title == listName)
                {
                    listIsExit = true;
                    break;
                }
            }

            if (listIsExit)
            {
                // Delete the list if exist.
                this.listsService.DeleteList(listName);
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a list in site collection.
        /// </summary>
        /// <param name="listName">The name of list that will be created in site collection.</param>
        /// <param name="templateID">A 32-bit integer that specifies the list template to use.</param>
        /// <param name="baseUrl">The site URL for connecting with the specified Document Workspace site.</param>
        /// <returns>A Boolean indicates whether the operation is executed successfully,
        /// TRUE means the operation is executed successfully, FALSE means not.</returns>
        public bool AddList(string listName, int templateID, string baseUrl)
        {
            this.RedirectBaseUrl(baseUrl);

            GetListCollectionResponseGetListCollectionResult getListResult = this.listsService.GetListCollection();

            // Check whether the specified list already exists in site collection.
            bool listIsExit = false;

            foreach (ListDefinitionCT list in getListResult.Lists)
            {
                string title = list.Title;
                if (title == listName)
                {
                    listIsExit = true;
                    break;
                }
            }

            // If the specified list does not exist in site collection, then create a new list.
            if (listIsExit == false)
            {
                // A 32-bit integer that specifies the list template to use.
                AddListResponseAddListResult result = this.listsService.AddList(listName, string.Empty, templateID);

                if (result.List != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
        /// <summary>
        /// Verify the message syntax of GetListCollection operation when the response is received 
        /// successfully.
        /// </summary>
        /// <param name="getListCollectionResult">The returned SOAP result.</param>
        private void VerifyGetListCollectionOperation(GetListCollectionResponseGetListCollectionResult getListCollectionResult)
        {
            Site.Assert.IsNotNull(getListCollectionResult, "The return value of this operation should have instance");

            // Verify R1791
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1791,
                @"[GetListCollection]<wsdl:operation name=""GetListCollection"">"
                + @"    <wsdl:input message=""GetListCollectionSoapIn"" />"
                + @"    <wsdl:output message=""GetListCollectionSoapOut"" />"
                + @"</wsdl:operation>");

            // Verify R581
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                581,
                @"[In GetListCollection operation] [If the protocol client sends a "
                + "GetListCollectionSoapIn request message] the server responds with a "
                + "GetListCollectionSoapOut response message.");

            // Verify R1795
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1795,
                @"[GetListCollectionSoapOut]The SOAP Body contains a GetListCollectionResponse "
                + "element.");

            // Verify R1797
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1797,
                @"[The schema of GetListCollectionResponse is defined as:]"
                + @"<s:element name=""GetListCollectionResponse"">"
                + @"  <s:complexType>"
                + @"    <s:sequence>"
                + @"      <s:element name=""GetListCollectionResult"" minOccurs=""0"">"
                + @"        <s:complexType mixed=""true"">"
                + @"          <s:sequence>"
                + @"            <s:element name=""Lists"">"
                + @"              <s:complexType>"
                + @"                <s:sequence>"
                + @"                  <s:element name=""List"" type=""tns:ListDefinitionCT"" minOccurs=""0"" "
                + @"                             maxOccurs=""unbounded""/>"
                + @"                </s:sequence>"
                + @"              </s:complexType>"
                + @"            </s:element>"
                + @"          </s:sequence>"
                + @"        </s:complexType>"
                + @"      </s:element>"
                + @"    </s:sequence>"
                + @"  </s:complexType>"
                + @"</s:element>");

            // Verify the requirements of the ListDefinitionCT complex type.
            foreach (ListDefinitionCT listDefinitionCTItem in getListCollectionResult.Lists)
            {
                this.VerifyListDefinitionCT(listDefinitionCTItem);

                if (listDefinitionCTItem.HasRelatedLists != null)
                {
                    this.Site.Assert.AreEqual<string>(string.Empty, listDefinitionCTItem.HasRelatedLists, "[ListDefinitionCT.HasRelatedLists] When it is returned in GetListCollection (section 3.1.4.17) this value will be an empty string.");
                    //Verify MS-LISTSWS requirement: MS-LISTSWS_R3010002
                    Site.CaptureRequirement(
                        3010002,
                        @"[ListDefinitionCT.HasRelatedLists] When it is returned by GetListCollection (section 3.1.4.17) this value will be an empty string.");
                }
            }
        }