/// <summary> /// The UpdateList operation is used to update list properties and add, remove, or update fields. /// </summary> /// <param name="listName">The name of the list which will be updated</param> /// <param name="listProperties">The properties of the specified list</param> /// <param name="newFields">new fields to be added to the list</param> /// <param name="updateFields">the fields to be updated in the list</param> /// <param name="deleteFields">the fields to be deleted from the list.</param> /// <param name="listVersion">A string represents an integer value that specifies the current version of the list</param> /// <returns>UpdateList Result</returns> public UpdateListResponseUpdateListResult UpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion) { this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized"); UpdateListResponseUpdateListResult result = null; try { result = this.listsProxy.UpdateList(listName, listProperties, newFields, updateFields, deleteFields, listVersion); // Verify the requirements of the UpdateList operation. this.VerifyUpdateListOperation(result); // Verify the requirements of the transport. this.VerifyTransportRequirements(); } catch (XmlSchemaValidationException exp) { // Log the errors and warnings this.LogSchemaValidationErrors(); this.Site.Assert.Fail(exp.Message); } catch (SoapException) { this.VerifySoapExceptionFault(); throw; } return result; }
public void MSLISTSWS_S01_TC13_GetListAndView_Succeed() { // Add a generic list with correct value. string listName = TestSuiteHelper.GetUniqueListName(); bool addListSucceeded = false; try { // Add a generic list. int templateId = (int)TemplateType.Generic_List; AddListResponseAddListResult addResult = this.listswsAdapter.AddList(listName, string.Empty, templateId); addListSucceeded = addResult != null && addResult.List != null && !string.IsNullOrEmpty(addResult.List.ID); this.Site.Assert.IsTrue(addListSucceeded, "Test suite should add the list successfully."); // Set list validation enabled. UpdateListListProperties properties = new UpdateListListProperties(); properties.List = new UpdateListListPropertiesList(); properties.List.Validation = new UpdateListListPropertiesListValidation(); properties.List.Validation.Message = TestSuiteHelper.GenerateRandomString(1024); this.listswsAdapter.UpdateList(addResult.List.Name, properties, null, null, null, null); // Call method GetListAndView with correct list name and set the viewName parameter to null. GetListAndViewResponseGetListAndViewResult getResultValid = this.listswsAdapter.GetListAndView(addResult.List.Name, null); // If the GetListAndViewResponse element is returned, then capture R568. Site.CaptureRequirementIfIsNotNull( getResultValid, 568, @"[In GetListAndView operation] If the specified listName is a valid GUID and corresponds to the identification of a list on the site, the protocol server MUST return a GetListAndViewResponse element."); // If the default view properties is returned, then capture R1777. Site.CaptureRequirementIfIsTrue( bool.Parse(getResultValid.ListAndView.View.DefaultView), 1777, @"[GetListAndView]If the specified viewName is not specified[ or is an empty string], the default view properties MUST be returned."); // Call method GetListAndView with correct list title which is an invalid GUID. GetListAndViewResponseGetListAndViewResult getResultInvalid = this.listswsAdapter.GetListAndView(addResult.List.Title, null); // If the GetListAndViewReponse element is returned, then capture R570. Site.CaptureRequirementIfIsNotNull( getResultInvalid, 570, @"[In GetListAndView operation] If the specified listName does not correspond to the identification of a list on the site, check if the listName corresponds to the list title of a list on the site and if so, the protocol server MUST return a GetListAndViewReponse element."); // If the GetListAndViewReponse element is returned, then capture R569. Site.CaptureRequirementIfIsNotNull( getResultInvalid, 569, @"[In GetListAndView operation] If the specified listName is not a valid GUID, check if the listName corresponds to the list title of a list on the site and if so, the protocol server MUST return a GetListAndViewReponse element."); // Call method GetListAndView by specifying a viewName with an empty string. GetListAndViewResponseGetListAndViewResult getResultEmptyViewName = this.listswsAdapter.GetListAndView(addResult.List.Name, string.Empty); this.Site.Assert.IsNotNull(getResultEmptyViewName, "GetListAndView operation failed."); // If the default view properties is returned, then capture R2257. Site.CaptureRequirementIfIsTrue( bool.Parse(getResultEmptyViewName.ListAndView.View.DefaultView), 2257, @"[GetListAndView]If the specified viewName [is not specified or] is an empty string, the default view properties MUST be returned."); } finally { if (addListSucceeded) { this.listswsAdapter.DeleteList(listName); } } }
/// <summary> /// A method used to update list properties and add, remove, or update fields. /// </summary> /// <param name="listName">A parameter represents the name of the list which will be updated.</param> /// <param name="listProperties">A parameter represents the properties of the specified list.</param> /// <param name="newFields">A parameter represents new fields which are added to the list.</param> /// <param name="updateFields">A parameter represents the fields which are updated in the list.</param> /// <param name="deleteFields">A parameter represents the fields which are deleted from the list.</param> /// <param name="listVersion">A parameter represents an integer format string that specifies the current version of the list.</param> /// <returns>A return value represents the actual update result.</returns> public UpdateListResponseUpdateListResult UpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion) { if (null == this.listsProxy) { throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter"); } UpdateListResponseUpdateListResult result = null; result = this.listsProxy.UpdateList(listName, listProperties, newFields, updateFields, deleteFields, listVersion); this.VerifyTransportRequirement(); return result; }
public void MSLISTSWS_S01_TC28_UpdateList_ListDefinitionCT() { IMS_LISTSWSSUTControlAdapter sutControlAdapter = this.Site.GetAdapter<IMS_LISTSWSSUTControlAdapter>(); // Create a list. string listName = TestSuiteHelper.GetUniqueListItemName(); string listId = TestSuiteHelper.CreateList(listName); #region Verify RootFolder in the list GetListResponseGetListResult getResultForNewList = this.listswsAdapter.GetList(listName); string listRootFolder = sutControlAdapter.GetListRootFolder(listName); System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^\d+$"); int listFirstVersion = getResultForNewList.List.Version; bool isMajorVersion = regex.IsMatch(listFirstVersion.ToString()); Site.Assert.IsTrue( isMajorVersion, "The numeric major revision of the list is {0}.", listFirstVersion); Site.Assert.AreEqual<string>( listRootFolder, getResultForNewList.List.RootFolder, "The RootFolder of the list is {0}.", getResultForNewList.List.RootFolder); // Verify R1375 Site.CaptureRequirement( 1375, @"[ListDefinitionCT.RootFolder:] The root folder of the list."); #endregion // Construct a UpdateListListProperties instance. UpdateListListProperties properties = new UpdateListListProperties(); properties.List = new UpdateListListPropertiesList(); // Generate a 10 length random string properties.List.Description = TestSuiteHelper.GenerateRandomString(10); properties.List.Hidden = "True"; properties.List.EnableVersioning = "True"; properties.List.Ordered = "True"; // Call UpdateListResponseUpdateListResult operation to update list properties. UpdateListResponseUpdateListResult updateListResult = null; updateListResult = this.listswsAdapter.UpdateList( listId, properties, null, null, null, null); Site.Assert.IsNotNull(updateListResult, "UpdateList operation succeeded."); // Verify R1364 isMajorVersion = regex.IsMatch(updateListResult.Results.ListProperties.Version.ToString()); bool isNumeric = updateListResult.Results.ListProperties.Version.Equals(listFirstVersion + 1); Site.CaptureRequirementIfIsTrue( isMajorVersion && isNumeric, 1364, @"[ListDefinitionCT.Version: ]The numeric major revision of the list."); // Verify R1353 Site.CaptureRequirementIfAreEqual<string>( updateListResult.Results.ListProperties.Title, listName, 1353, @"[ListDefinitionCT.Title:] The display name of the list."); // Verify R1354 Site.CaptureRequirementIfAreEqual<string>( updateListResult.Results.ListProperties.Description, properties.List.Description, 1354, @"[ListDefinitionCT.Description:] The description of the list."); #region Capture Requirements R159 Site.CaptureRequirementIfIsTrue( Convert.ToBoolean(updateListResult.Results.ListProperties.ShowUser), 159, "[ListDefinitionCT.ShowUser] True if this list is a survey list and user names are included in responses."); #endregion #region Capture requirement R156, R157, R158 Site.CaptureRequirementIfIsTrue( Convert.ToBoolean(updateListResult.Results.ListProperties.EnableVersioning), 156, "[ListDefinitionCT.EnableVersioning] True if this list is a document library and version control is enabled."); Site.CaptureRequirementIfIsTrue( Convert.ToBoolean(updateListResult.Results.ListProperties.Hidden), 157, "[ListDefinitionCT.Hidden] True if this list is hidden."); Site.CaptureRequirementIfIsTrue( Convert.ToBoolean(updateListResult.Results.ListProperties.Hidden), 158, "[ListDefinitionCT.Ordered] True if list items can be explicitly re-ordered."); #endregion // Create a document library. listId = TestSuiteHelper.CreateList(Convert.ToInt32(TemplateType.Document_Library)); // Set Custom Send To Destination Name and Url for document library. sutControlAdapter.SetSendToNameAndUrl(listId, AdapterHelper.SendToDestinationName, AdapterHelper.SendToDestinationUrl); // Enable the versioning of the list. bool isSetVersionLimitSuccess = sutControlAdapter.SetVersionLimit(listId, AdapterHelper.MajorVersionLimitValue, AdapterHelper.MajorWithMinorVersionsLimitValue); Site.Assert.IsTrue( isSetVersionLimitSuccess, "SetVersioning operation returns {0}, TRUE means the operation was executed successfully," + " FALSE means the operation failed", isSetVersionLimitSuccess); // Call UpdateListResponseUpdateListResult operation to update list properties. updateListResult = this.listswsAdapter.UpdateList( listId, null, null, null, null, null); Site.Assert.IsNotNull(updateListResult, "UpdateList operation succeeded."); Site.Assert.IsNotNull(updateListResult.Results.ListProperties.SendToLocation, "The SendToLocation property should not be null when SendToDestinationName and SendToDestinationUrl is set."); // Verify MS-LISTSWS requirement: MS-LISTSWS_R1390 // If the SendToLocation can be split to two string, then the following // requirement can be captured. string[] strSendTo = updateListResult.Results.ListProperties.SendToLocation.Split('|'); Site.CaptureRequirementIfAreEqual<int>( 2, strSendTo.Length, 1390, @"[ListDefinitionCT.SendToLocation:]These two items are returned as a string with " + @"a '|' character in between them."); // Verify MS-LISTSWS requirement: MS-LISTSWS_R1393 // If the MajorVersionLimit can be parsed to a int value, then the following // requirement can be captured. Site.CaptureRequirementIfAreEqual<int>( AdapterHelper.MajorVersionLimitValue, updateListResult.Results.ListProperties.MajorVersionLimit, 1393, @"[ListDefinitionCT.MajorVersionLimit: ]The maximum number of major versions allowed for a document in a document library that uses version control with major versions only."); // Verify MS-LISTSWS requirement: MS-LISTSWS_R1394 // If the MajorWithMinorVersionsLimit can be parsed to a int value, then the following // requirement can be captured. Site.CaptureRequirementIfAreEqual<int>( AdapterHelper.MajorWithMinorVersionsLimitValue, updateListResult.Results.ListProperties.MajorWithMinorVersionsLimit, 1394, @"[ListDefinitionCT.MajorWithMinorVersionsLimit:] The maximum number of major versions that are allowed for a document in a document library that uses version control with both major versions and minor versions."); #region Capture Requirements R1357 Site.CaptureRequirementIfAreEqual<string>( ((int)BaseType.Document_Library).ToString(), updateListResult.Results.ListProperties.BaseType, 1357, "[ListDefinitionCT.BaseType:] The base type of the list"); #endregion #region Capture Requirements R1360 Site.CaptureRequirementIfAreEqual<string>( ((int)TemplateType.Document_Library).ToString(), updateListResult.Results.ListProperties.ServerTemplate, 1360, "[ListDefinitionCT.ServerTemplate:] The value[of ListDefinitionCT.ServerTemplate] corresponding to the template that the list is based on."); #endregion // Create an issues list. listId = TestSuiteHelper.CreateList(Convert.ToInt32(TemplateType.Issues)); // Call UpdateListResponseUpdateListResult operation to update list properties. updateListResult = this.listswsAdapter.UpdateList( listId, null, null, null, null, null); Site.Assert.IsNotNull(updateListResult, "UpdateList operation succeeded."); #region Capture Requirements R1357 Site.CaptureRequirementIfAreEqual<string>( ((int)BaseType.Issues).ToString(), updateListResult.Results.ListProperties.BaseType, 1357, "[ListDefinitionCT.BaseType:] The base type of the list"); #endregion #region Capture Requirements R1360 Site.CaptureRequirementIfAreEqual<string>( ((int)TemplateType.Issues).ToString(), updateListResult.Results.ListProperties.ServerTemplate, 1360, "[ListDefinitionCT.ServerTemplate:] The value[of ListDefinitionCT.ServerTemplate] corresponding to the template that the list is based on."); #endregion #region Capture Requirement R5641 Site.CaptureRequirementIfIsNotNull( updateListResult.Results.ListProperties.EnableAssignedToEmail, 5641, "[ListDefinitionCT.EnableAssignedToEmail] This attribute is present if the current list is an issues list."); #endregion listId = TestSuiteHelper.CreateList(Convert.ToInt32(TemplateType.Generic_List)); // Call UpdateListResponseUpdateListResult operation to update list properties. updateListResult = this.listswsAdapter.UpdateList( listId, null, null, null, null, null); Site.Assert.IsNotNull(updateListResult, "UpdateList operation succeeded."); #region Capture Requirements R1357 Site.CaptureRequirementIfAreEqual<string>( ((int)BaseType.Generic_List).ToString(), updateListResult.Results.ListProperties.BaseType, 1357, "[ListDefinitionCT.BaseType:] The base type of the list"); #endregion #region Capture Requirements R1360 Site.CaptureRequirementIfAreEqual<string>( ((int)TemplateType.Generic_List).ToString(), updateListResult.Results.ListProperties.ServerTemplate, 1360, "[ListDefinitionCT.ServerTemplate:] The value[of ListDefinitionCT.ServerTemplate] corresponding to the template that the list is based on."); #endregion #region Capture Requirement R5642 Site.CaptureRequirementIfIsNull( updateListResult.Results.ListProperties.EnableAssignedToEmail, 5642, "[ListDefinitionCT.EnableAssignedToEmail] This attribute is not present if the current list is not an issues list."); #endregion // Create a Survey list listId = TestSuiteHelper.CreateList(Convert.ToInt32(TemplateType.Survey)); // Call UpdateListResponseUpdateListResult operation to update list properties. updateListResult = this.listswsAdapter.UpdateList( listId, null, null, null, null, null); Site.Assert.IsNotNull(updateListResult, "UpdateList operation succeeded."); #region Capture Requirements R1357 Site.CaptureRequirementIfAreEqual<string>( ((int)BaseType.Survey).ToString(), updateListResult.Results.ListProperties.BaseType, 1357, "[ListDefinitionCT.BaseType:] The base type of the list"); #endregion #region Capture Requirements R1360 Site.CaptureRequirementIfAreEqual<string>( ((int)TemplateType.Survey).ToString(), updateListResult.Results.ListProperties.ServerTemplate, 1360, "[ListDefinitionCT.ServerTemplate:] The value[of ListDefinitionCT.ServerTemplate] corresponding to the template that the list is based on."); #endregion // Create a Discussion board list listId = TestSuiteHelper.CreateList(Convert.ToInt32(TemplateType.Discussion_Board)); // Call UpdateListResponseUpdateListResult operation to update list properties. updateListResult = this.listswsAdapter.UpdateList( listId, null, null, null, null, null); Site.Assert.IsNotNull(updateListResult, "UpdateList operation succeeded."); #region Capture Requirements R1357 Site.CaptureRequirementIfAreEqual<string>( ((int)BaseType.Generic_List).ToString(), updateListResult.Results.ListProperties.BaseType, 1357, "[ListDefinitionCT.BaseType:] The base type of the list"); #endregion #region Capture Requirements R1360 Site.CaptureRequirementIfAreEqual<string>( ((int)TemplateType.Discussion_Board).ToString(), updateListResult.Results.ListProperties.ServerTemplate, 1360, "[ListDefinitionCT.ServerTemplate:] The value[of ListDefinitionCT.ServerTemplate] corresponding to the template that the list is based on."); #endregion }
/// <remarks/> public void UpdateListAsync(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion, object userState) { if ((this.UpdateListOperationCompleted == null)) { this.UpdateListOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateListOperationCompleted); } this.InvokeAsync("UpdateList", new object[] { listName, listProperties, newFields, updateFields, deleteFields, listVersion}, this.UpdateListOperationCompleted, userState); }
/// <remarks/> public void UpdateListAsync(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion) { this.UpdateListAsync(listName, listProperties, newFields, updateFields, deleteFields, listVersion, null); }
/// <remarks/> public System.IAsyncResult BeginUpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdateList", new object[] { listName, listProperties, newFields, updateFields, deleteFields, listVersion}, callback, asyncState); }
public UpdateListResponseUpdateListResult UpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion) { object[] results = this.Invoke("UpdateList", new object[] { listName, listProperties, newFields, updateFields, deleteFields, listVersion}); return ((UpdateListResponseUpdateListResult)(results[0])); }