public void MSWEBSS_S07_TC06_UpdateColumns_Unauthenticated() { Adapter.InitializeService(UserAuthentication.Unauthenticated); try { UpdateColumnsMethod[] newFileds = new UpdateColumnsMethod[1]; UpdateColumnsMethod1[] updateFileds = new UpdateColumnsMethod1[1]; UpdateColumnsMethod2[] deleteFileds = new UpdateColumnsMethod2[1]; Adapter.UpdateColumns( newFileds, updateFileds, deleteFileds); Site.Assert.Fail("The expected http status code is not returned for the UpdateColumns operation."); } catch (WebException exp) { if (exp.Response == null) { throw; } // Verify MS-WEBSS requirement: MS-WEBSS_R1086 // COMMENT: When the UpdateColumns operation is invoked by unauthenticated user, if the // server return the expected http status code, then the requirement can be captured. HttpWebResponse resp = exp.Response as HttpWebResponse; Site.CaptureRequirementIfAreEqual <HttpStatusCode>( HttpStatusCode.Unauthorized, resp.StatusCode, 1086, @"[In Message Processing Events and Sequencing Rules] If the user is not authorized to perform the operation[UpdateColumns], the protocol server MUST return an HTTP 401 error as specified in [RFC2616] section 10.4."); } }
public void MSWEBSS_S07_TC13_UpdateColumns_NoNameOrDisplayName() { #region Set up the environment. UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[1]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); #endregion UpdateColumnsResponseUpdateColumnsResult updateColumnsResult = Adapter.UpdateColumns(newFields, null, null); #region Capture No Name Or Display Name of new Fields Related Requirement bool isCorrectResponseResult = (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.NewFields[0].ErrorCode) && (updateColumnsResult.Results.NewFields[0].ErrorText != null); Site.Assert.AreEqual <string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.NewFields[0].ErrorCode, "The expected error code {0} should be returned in NewFields of the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.NewFields[0].ErrorText, "The ErrorText of NewFields in UpdateColumnsResponse should not be null"); // Verify MS-WEBSS requirement: MS-WEBSS_R466 Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 466, @"[In UpdateColumns] If an error occurs, the protocol server MUST return an appropriate error code and error string."); // Verify MS-WEBSS requirement: MS-WEBSS_R825 Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 825, @"[In UpdateColumnsResponse] If the protocol server encounters one of the error conditions[Neither the Name nor the DisplayName attribute is passed in a Field element of newFields.] in the following table while running this operation[UpdateColumns], ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element."); if (Common.IsRequirementEnabled(833, this.Site)) { // Verify MS-WEBSS requirement: MS-WEBSS_R833 this.Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 833, @"[In UpdateColumnsResponse] If implementation does encounter one of the error conditions in the following table while running this operation, ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element, which contain one of the error codes in the following table for the specified error condition[Neither the Name nor the DisplayName attribute is passed in a Field element of newFields.]. [The 2007 Microsoft® Office system Microsoft® Office 2010 suites Microsoft® Office SharePoint® Server 2007 Windows® SharePoint® Services 3.0 Microsoft® SharePoint® Foundation 2010 Microsoft® SharePoint® Foundation 2013]"); } #endregion }
/// <summary> /// Do initialization for Updated columns with new fields. /// </summary> protected void InitUpdateColumn() { UpdateColumnsMethod[] newFieldsForUpdate = new UpdateColumnsMethod[1]; newFieldsForUpdate[0] = new UpdateColumnsMethod(); newFieldsForUpdate[0].Field = new FieldDefinition(); newFieldsForUpdate[0].ID = ((uint)CONST_MethodIDUNITS.Five).ToString(); newFieldsForUpdate[0].Field.Name = this.fieldNameForUpdate; newFieldsForUpdate[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); newFieldsForUpdate[0].Field.DisplayName = this.GenerateRandomString(10); Adapter.UpdateColumns(newFieldsForUpdate, null, null); // Add a column that is used to be deleted in test case. UpdateColumnsMethod[] newFieldsForDelete = new UpdateColumnsMethod[1]; newFieldsForDelete[0] = new UpdateColumnsMethod(); newFieldsForDelete[0].Field = new FieldDefinition(); newFieldsForDelete[0].ID = ((uint)CONST_MethodIDUNITS.Five).ToString(); newFieldsForDelete[0].Field.Name = this.GenerateRandomString(10); newFieldsForDelete[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); newFieldsForDelete[0].Field.DisplayName = this.GenerateRandomString(10); Adapter.UpdateColumns(newFieldsForDelete, null, null); }
public void MSWEBSS_S07_TC07_UpdateColumns_NewFieldsWithMultipleMethodNoFields() { #region Set up the environment this.InitUpdateColumn(); UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[2]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].Field.Name = this.GenerateRandomString(10); newFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[1] = new UpdateColumnsMethod(); newFields[1].Field = new FieldDefinition(); newFields[1].Field.Name = this.GenerateRandomString(10); newFields[1].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); newFields[1].ID = ((uint)CONST_MethodIDUNITS.Two).ToString(); #endregion try { Adapter.UpdateColumns(newFields, null, null); Site.Assert.Fail("The expected SOAP fault is not returned for the UpdateColumns operation."); } catch (SoapException) { // Catch the exception, then the following requirements will be captured. // Verify MS-WEBSS requirement: MS-WEBSS_R515 Site.CaptureRequirement( 515, @"[In UpdateColumnsResponse] [A SOAP fault MUST be returned if the protocol server encounters the following error condition while running this operation] Occurs when one of the newFields elements of the UpdateColumns element has multiple Method elements without a Fields element defined as the root element."); // Verify MS-WEBSS requirement: MS-WEBSS_R514 Site.CaptureRequirement( 514, @"[In UpdateColumnsResponse] When an invalid XML element is passed in as newFields element , a SOAP fault MUST be returned."); } }
public void MSWEBSS_S07_TC13_UpdateColumns_NoNameOrDisplayName() { #region Set up the environment. UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[1]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); #endregion UpdateColumnsResponseUpdateColumnsResult updateColumnsResult = Adapter.UpdateColumns(newFields, null, null); #region Capture No Name Or Display Name of new Fields Related Requirement bool isCorrectResponseResult = (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.NewFields[0].ErrorCode) && (updateColumnsResult.Results.NewFields[0].ErrorText != null); Site.Assert.AreEqual<string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.NewFields[0].ErrorCode, "The expected error code {0} should be returned in NewFields of the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.NewFields[0].ErrorText, "The ErrorText of NewFields in UpdateColumnsResponse should not be null"); // Verify MS-WEBSS requirement: MS-WEBSS_R466 Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 466, @"[In UpdateColumns] If an error occurs, the protocol server MUST return an appropriate error code and error string."); // Verify MS-WEBSS requirement: MS-WEBSS_R825 Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 825, @"[In UpdateColumnsResponse] If the protocol server encounters one of the error conditions[Neither the Name nor the DisplayName attribute is passed in a Field element of newFields.] in the following table while running this operation[UpdateColumns], ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element."); if (Common.IsRequirementEnabled(833, this.Site)) { // Verify MS-WEBSS requirement: MS-WEBSS_R833 this.Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 833, @"[In UpdateColumnsResponse] If implementation does encounter one of the error conditions in the following table while running this operation, ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element, which contain one of the error codes in the following table for the specified error condition[Neither the Name nor the DisplayName attribute is passed in a Field element of newFields.]. [The 2007 Microsoft® Office system Microsoft® Office 2010 suites Microsoft® Office SharePoint® Server 2007 Windows® SharePoint® Services 3.0 Microsoft® SharePoint® Foundation 2010 Microsoft® SharePoint® Foundation 2013]"); } #endregion }
public void MSWEBSS_S07_TC01_UpdateColumns_InvalidFieldDefinition() { #region Set up the environment. this.InitUpdateColumn(); UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[1]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[0].Field.Name = this.GenerateRandomString(10); UpdateColumnsMethod1[] updateFields = new UpdateColumnsMethod1[1]; updateFields[0] = new UpdateColumnsMethod1(); updateFields[0].Field = new FieldDefinition(); updateFields[0].ID = ((uint)CONST_MethodIDUNITS.Three).ToString(); updateFields[0].Field.Name = this.FieldNameForUpdate; UpdateColumnsMethod2[] deleteFields = new UpdateColumnsMethod2[1]; deleteFields[0] = new UpdateColumnsMethod2(); deleteFields[0].Field = new FieldDefinition(); deleteFields[0].ID = ((uint)CONST_MethodIDUNITS.Five).ToString(); #endregion UpdateColumnsResponseUpdateColumnsResult updateColumnsResult = Adapter.UpdateColumns(newFields, updateFields, deleteFields); #region Capture Invalid Field Definition Related Requirement bool isCorrectResponseResult = (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.NewFields[0].ErrorCode) && (updateColumnsResult.Results.NewFields[0].ErrorText != null) && (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.UpdateFields[0].ErrorCode) && (updateColumnsResult.Results.UpdateFields[0].ErrorText != null) && (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.DeleteFields[0].ErrorCode) && (updateColumnsResult.Results.DeleteFields[0].ErrorText != null); Site.Assert.AreEqual<string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.NewFields[0].ErrorCode, "The expected error code {0} should be returned in NewFields of the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.NewFields[0].ErrorText, "The ErrorText of NewFields in UpdateColumnsResponse should not be null"); Site.Assert.AreEqual<string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.DeleteFields[0].ErrorCode, "The expected error code {0} of DeleteFields should be returned in the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.DeleteFields[0].ErrorText, "The ErrorText of DeleteFields in UpdateColumnsResponse should not be null"); Site.Assert.AreEqual<string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.UpdateFields[0].ErrorCode, "The expected error code {0} of UpdateFields should be returned in the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.UpdateFields[0].ErrorText, "The ErrorText of UpdateFields in UpdateColumnsResponse should not be null"); // Verify MS-WEBSS requirement: MS-WEBSS_R466 Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 466, @"[In UpdateColumns] If an error occurs, the protocol server MUST return an appropriate error code and error string."); // Verify MS-WEBSS requirement: MS-WEBSS_R826 this.Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 826, @"[In UpdateColumnsResponse] If the protocol server encounters one of the error conditions[An invalid Field element is passed in any of the parameters.] in the following table while running this operation[UpdateColumns], ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element."); if (Common.IsRequirementEnabled(834, this.Site)) { // Verify MS-WEBSS requirement: MS-WEBSS_R834 this.Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 834, @"[In UpdateColumnsResponse] If implementation does encounter one of the error conditions in the following table while running this operation, ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element, which contain one of the error codes in the following table for the specified error condition[An invalid Field element is passed in any of the parameters.]. [The 2007 Microsoft® Office system Microsoft® Office 2010 suites Microsoft® Office SharePoint® Server 2007 Windows® SharePoint® Services 3.0 Microsoft® SharePoint® Foundation 2010 Microsoft® SharePoint® Foundation 2013]"); } #endregion }
public void MSWEBSS_S07_TC07_UpdateColumns_NewFieldsWithMultipleMethodNoFields() { #region Set up the environment this.InitUpdateColumn(); UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[2]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].Field.Name = this.GenerateRandomString(10); newFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[1] = new UpdateColumnsMethod(); newFields[1].Field = new FieldDefinition(); newFields[1].Field.Name = this.GenerateRandomString(10); newFields[1].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); newFields[1].ID = ((uint)CONST_MethodIDUNITS.Two).ToString(); UpdateColumnsMethod1[] updateFields = new UpdateColumnsMethod1[2]; updateFields[0] = new UpdateColumnsMethod1(); updateFields[0].Field = new FieldDefinition(); updateFields[0].ID = ((uint)CONST_MethodIDUNITS.Three).ToString(); updateFields[0].Field.Name = this.GenerateRandomString(10); updateFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); updateFields[0].Field.DisplayName = this.GenerateRandomString(10); updateFields[1] = new UpdateColumnsMethod1(); updateFields[1].Field = new FieldDefinition(); updateFields[1].ID = ((uint)CONST_MethodIDUNITS.Four).ToString(); updateFields[1].Field.Name = this.GenerateRandomString(10); updateFields[1].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); updateFields[1].Field.DisplayName = this.GenerateRandomString(10); #endregion try { Adapter.UpdateColumns(newFields, null, null); Site.Assert.Fail("The expected SOAP fault is not returned for the UpdateColumns operation."); } catch (SoapException) { // Catch the exception, then the following requirements will be captured. // Verify MS-WEBSS requirement: MS-WEBSS_R515 Site.CaptureRequirement( 515, @"[In UpdateColumnsResponse] [A SOAP fault MUST be returned if the protocol server encounters the following error condition while running this operation] Occurs when one of the newFields elements of the UpdateColumns element has multiple Method elements without a Fields element defined as the root element."); // Verify MS-WEBSS requirement: MS-WEBSS_R514 Site.CaptureRequirement( 514, @"[In UpdateColumnsResponse] When an invalid XML element is passed in as newFields element , a SOAP fault MUST be returned."); } try { Adapter.UpdateColumns(null,updateFields, null); Site.Assert.Fail("The expected SOAP fault is not returned for the UpdateColumns operation."); } catch (SoapException) { // Catch the exception, then the following requirements will be captured. // Verify MS-WEBSS requirement: MS-WEBSS_R822 Site.CaptureRequirement( 822, @"[In UpdateColumnsResponse] When an invalid element is the child element of the [newFields, ]updateFields[, or deleteFields elements], a SOAP fault MUST be returned."); } }
public void MSWEBSS_S07_TC06_UpdateColumns_Unauthenticated() { Adapter.InitializeService(UserAuthentication.Unauthenticated); try { UpdateColumnsMethod[] newFileds = new UpdateColumnsMethod[1]; UpdateColumnsMethod1[] updateFileds = new UpdateColumnsMethod1[1]; UpdateColumnsMethod2[] deleteFileds = new UpdateColumnsMethod2[1]; Adapter.UpdateColumns( newFileds, updateFileds, deleteFileds); Site.Assert.Fail("The expected http status code is not returned for the UpdateColumns operation."); } catch (WebException exp) { if (exp.Response == null) { throw; } // Verify MS-WEBSS requirement: MS-WEBSS_R1086 // COMMENT: When the UpdateColumns operation is invoked by unauthenticated user, if the // server return the expected http status code, then the requirement can be captured. HttpWebResponse resp = exp.Response as HttpWebResponse; Site.CaptureRequirementIfAreEqual<HttpStatusCode>( HttpStatusCode.Unauthorized, resp.StatusCode, 1086, @"[In Message Processing Events and Sequencing Rules] If the user is not authorized to perform the operation[UpdateColumns], the protocol server MUST return an HTTP 401 error as specified in [RFC2616] section 10.4."); } }
public void MSWEBSS_S07_TC03_UpdateColumns_AllFieldsValid() { #region Set up the environment this.InitUpdateColumn(); // Update to new interface UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[1]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[0].Field.Name = this.GenerateRandomString(10); newFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); // Update to new interface UpdateColumnsMethod1[] updateFields = new UpdateColumnsMethod1[1]; updateFields[0] = new UpdateColumnsMethod1(); updateFields[0].Field = new FieldDefinition(); updateFields[0].ID = ((uint)CONST_MethodIDUNITS.Three).ToString(); updateFields[0].Field.Name = this.GenerateRandomString(10); updateFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); updateFields[0].Field.DisplayName = this.GenerateRandomString(10); // Update to new interface UpdateColumnsMethod2[] deleteFields = new UpdateColumnsMethod2[1]; deleteFields[0] = new UpdateColumnsMethod2(); deleteFields[0].Field = new FieldDefinition(); deleteFields[0].ID = ((uint)CONST_MethodIDUNITS.Five).ToString(); deleteFields[0].Field.Name = this.GenerateRandomString(10); #endregion UpdateColumnsResponseUpdateColumnsResult updateColumnsResult = Adapter.UpdateColumns(newFields, updateFields, deleteFields); #region Capture All Fields Valid Related Requirement // Verify MS-WEBSS requirement: MS-WEBSS_R465 bool isVerifiedR465 = updateColumnsResult != null; Site.CaptureRequirementIfIsTrue( isVerifiedR465, 465, @"[In UpdateColumns] If the operation succeeds, it MUST return an UpdateColumnsResponse element."); // Verify MS-WEBSS requirement: MS-WEBSS_R508 Site.CaptureRequirementIfAreEqual<string>( newFields[0].ID, updateColumnsResult.Results.NewFields[0].ID, 508, @"[In UpdateColumnsResponse] Method.ID: This attribute MUST have the same value as the Method.ID attribute that was sent to the protocol server in the UpdateColumns message of this UpdateColumnsResponse for an add operation."); // Verify MS-WEBSS requirement: MS-WEBSS_R473 Site.CaptureRequirementIfAreEqual<string>( newFields[0].ID, updateColumnsResult.Results.NewFields[0].ID, 473, @"[In UpdateColumnsSoapOut] This message[UpdateColumnsSoapOut] is the response message to perform the following operations on the context site and all child sites in its hierarchy: Adding one or more specified new columns."); // Verify MS-WEBSS requirement: MS-WEBSS_R837 Site.CaptureRequirementIfAreEqual<string>( updateFields[0].ID, updateColumnsResult.Results.UpdateFields[0].ID, 837, @"[In UpdateColumnsResponse] Method.ID: This attribute MUST have the same value as the Method.ID attribute that was sent to the protocol server in the UpdateColumns message of this UpdateColumnsResponse for an update operation."); // Verify MS-WEBSS requirement: MS-WEBSS_R474 Site.CaptureRequirementIfAreEqual<string>( updateFields[0].ID, updateColumnsResult.Results.UpdateFields[0].ID, 474, @"[In UpdateColumnsSoapOut] Updating one or more specified existing columns."); // Verify MS-WEBSS requirement: MS-WEBSS_R838 Site.CaptureRequirementIfAreEqual<string>( deleteFields[0].ID, updateColumnsResult.Results.DeleteFields[0].ID, 838, @"[In UpdateColumnsResponse] Method.ID: This attribute MUST have the same value as the Method.ID attribute that was sent to the protocol server in the UpdateColumns message of this UpdateColumnsResponse for a delete operation."); // Verify MS-WEBSS requirement: MS-WEBSS_R475 Site.CaptureRequirementIfAreEqual<string>( deleteFields[0].ID, updateColumnsResult.Results.DeleteFields[0].ID, 475, @"[In UpdateColumnsSoapOut] Deleting one or more specified existing columns."); // Verify MS-WEBSS requirement: MS-WEBSS_R1037 Site.Assert.IsFalse(!Common.IsRequirementEnabled(1037, this.Site), "This operation UpdateColumns failed."); if (Common.IsRequirementEnabled(1037, this.Site)) { // If the operation UpdateColumns failed,verify MS-WEBSS requirement: MS-WEBSS_R1037 Site.CaptureRequirement( 1037, @"[In Appendix B: Product Behavior] Implementation does support this[UpdateColumns] operation.(<21> Windows SharePoint Services 3.0 and above follow this behavior.)"); } #endregion }
public void MSWEBSS_S07_TC01_UpdateColumns_InvalidFieldDefinition() { #region Set up the environment. this.InitUpdateColumn(); UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[1]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[0].Field.Name = this.GenerateRandomString(10); UpdateColumnsMethod1[] updateFields = new UpdateColumnsMethod1[1]; updateFields[0] = new UpdateColumnsMethod1(); updateFields[0].Field = new FieldDefinition(); updateFields[0].ID = ((uint)CONST_MethodIDUNITS.Three).ToString(); updateFields[0].Field.Name = this.FieldNameForUpdate; UpdateColumnsMethod2[] deleteFields = new UpdateColumnsMethod2[1]; deleteFields[0] = new UpdateColumnsMethod2(); deleteFields[0].Field = new FieldDefinition(); deleteFields[0].ID = ((uint)CONST_MethodIDUNITS.Five).ToString(); #endregion UpdateColumnsResponseUpdateColumnsResult updateColumnsResult = Adapter.UpdateColumns(newFields, updateFields, deleteFields); #region Capture Invalid Field Definition Related Requirement bool isCorrectResponseResult = (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.NewFields[0].ErrorCode) && (updateColumnsResult.Results.NewFields[0].ErrorText != null) && (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.UpdateFields[0].ErrorCode) && (updateColumnsResult.Results.UpdateFields[0].ErrorText != null) && (SoapErrorCode.ErrorCode0x80004005 == updateColumnsResult.Results.DeleteFields[0].ErrorCode) && (updateColumnsResult.Results.DeleteFields[0].ErrorText != null); Site.Assert.AreEqual <string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.NewFields[0].ErrorCode, "The expected error code {0} should be returned in NewFields of the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.NewFields[0].ErrorText, "The ErrorText of NewFields in UpdateColumnsResponse should not be null"); Site.Assert.AreEqual <string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.DeleteFields[0].ErrorCode, "The expected error code {0} of DeleteFields should be returned in the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.DeleteFields[0].ErrorText, "The ErrorText of DeleteFields in UpdateColumnsResponse should not be null"); Site.Assert.AreEqual <string>( SoapErrorCode.ErrorCode0x80004005, updateColumnsResult.Results.UpdateFields[0].ErrorCode, "The expected error code {0} of UpdateFields should be returned in the UpdateColumnsResponse element.", SoapErrorCode.ErrorCode0x80004005); Site.Assert.IsNotNull(updateColumnsResult.Results.UpdateFields[0].ErrorText, "The ErrorText of UpdateFields in UpdateColumnsResponse should not be null"); // Verify MS-WEBSS requirement: MS-WEBSS_R466 Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 466, @"[In UpdateColumns] If an error occurs, the protocol server MUST return an appropriate error code and error string."); // Verify MS-WEBSS requirement: MS-WEBSS_R826 this.Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 826, @"[In UpdateColumnsResponse] If the protocol server encounters one of the error conditions[An invalid Field element is passed in any of the parameters.] in the following table while running this operation[UpdateColumns], ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element."); if (Common.IsRequirementEnabled(834, this.Site)) { // Verify MS-WEBSS requirement: MS-WEBSS_R834 this.Site.CaptureRequirementIfIsTrue( isCorrectResponseResult, 834, @"[In UpdateColumnsResponse] If implementation does encounter one of the error conditions in the following table while running this operation, ErrorCode[0x80004005] and ErrorText elements MUST be returned in the UpdateColumnsResponse element, which contain one of the error codes in the following table for the specified error condition[An invalid Field element is passed in any of the parameters.]. [The 2007 Microsoft® Office system Microsoft® Office 2010 suites Microsoft® Office SharePoint® Server 2007 Windows® SharePoint® Services 3.0 Microsoft® SharePoint® Foundation 2010 Microsoft® SharePoint® Foundation 2013]"); } #endregion }
public void MSWEBSS_S07_TC03_UpdateColumns_AllFieldsValid() { #region Set up the environment this.InitUpdateColumn(); // Update to new interface UpdateColumnsMethod[] newFields = new UpdateColumnsMethod[1]; newFields[0] = new UpdateColumnsMethod(); newFields[0].Field = new FieldDefinition(); newFields[0].ID = ((uint)CONST_MethodIDUNITS.One).ToString(); newFields[0].Field.Name = this.GenerateRandomString(10); newFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); // Update to new interface UpdateColumnsMethod1[] updateFields = new UpdateColumnsMethod1[1]; updateFields[0] = new UpdateColumnsMethod1(); updateFields[0].Field = new FieldDefinition(); updateFields[0].ID = ((uint)CONST_MethodIDUNITS.Three).ToString(); updateFields[0].Field.Name = this.GenerateRandomString(10); updateFields[0].Field.Type = Common.GetConfigurationPropertyValue("UpdateColumns_Type", this.Site); updateFields[0].Field.DisplayName = this.GenerateRandomString(10); // Update to new interface UpdateColumnsMethod2[] deleteFields = new UpdateColumnsMethod2[1]; deleteFields[0] = new UpdateColumnsMethod2(); deleteFields[0].Field = new FieldDefinition(); deleteFields[0].ID = ((uint)CONST_MethodIDUNITS.Five).ToString(); deleteFields[0].Field.Name = this.GenerateRandomString(10); #endregion UpdateColumnsResponseUpdateColumnsResult updateColumnsResult = Adapter.UpdateColumns(newFields, updateFields, deleteFields); #region Capture All Fields Valid Related Requirement // Verify MS-WEBSS requirement: MS-WEBSS_R465 bool isVerifiedR465 = updateColumnsResult != null; Site.CaptureRequirementIfIsTrue( isVerifiedR465, 465, @"[In UpdateColumns] If the operation succeeds, it MUST return an UpdateColumnsResponse element."); // Verify MS-WEBSS requirement: MS-WEBSS_R508 Site.CaptureRequirementIfAreEqual <string>( newFields[0].ID, updateColumnsResult.Results.NewFields[0].ID, 508, @"[In UpdateColumnsResponse] Method.ID: This attribute MUST have the same value as the Method.ID attribute that was sent to the protocol server in the UpdateColumns message of this UpdateColumnsResponse for an add operation."); // Verify MS-WEBSS requirement: MS-WEBSS_R473 Site.CaptureRequirementIfAreEqual <string>( newFields[0].ID, updateColumnsResult.Results.NewFields[0].ID, 473, @"[In UpdateColumnsSoapOut] This message[UpdateColumnsSoapOut] is the response message to perform the following operations on the context site and all child sites in its hierarchy: Adding one or more specified new columns." ); // Verify MS-WEBSS requirement: MS-WEBSS_R837 Site.CaptureRequirementIfAreEqual <string>( updateFields[0].ID, updateColumnsResult.Results.UpdateFields[0].ID, 837, @"[In UpdateColumnsResponse] Method.ID: This attribute MUST have the same value as the Method.ID attribute that was sent to the protocol server in the UpdateColumns message of this UpdateColumnsResponse for an update operation."); // Verify MS-WEBSS requirement: MS-WEBSS_R474 Site.CaptureRequirementIfAreEqual <string>( updateFields[0].ID, updateColumnsResult.Results.UpdateFields[0].ID, 474, @"[In UpdateColumnsSoapOut] Updating one or more specified existing columns."); // Verify MS-WEBSS requirement: MS-WEBSS_R838 Site.CaptureRequirementIfAreEqual <string>( deleteFields[0].ID, updateColumnsResult.Results.DeleteFields[0].ID, 838, @"[In UpdateColumnsResponse] Method.ID: This attribute MUST have the same value as the Method.ID attribute that was sent to the protocol server in the UpdateColumns message of this UpdateColumnsResponse for a delete operation."); // Verify MS-WEBSS requirement: MS-WEBSS_R475 Site.CaptureRequirementIfAreEqual <string>( deleteFields[0].ID, updateColumnsResult.Results.DeleteFields[0].ID, 475, @"[In UpdateColumnsSoapOut] Deleting one or more specified existing columns."); // Verify MS-WEBSS requirement: MS-WEBSS_R1037 Site.Assert.IsFalse(!Common.IsRequirementEnabled(1037, this.Site), "This operation UpdateColumns failed."); if (Common.IsRequirementEnabled(1037, this.Site)) { // If the operation UpdateColumns failed,verify MS-WEBSS requirement: MS-WEBSS_R1037 Site.CaptureRequirement( 1037, @"[In Appendix B: Product Behavior] Implementation does support this[UpdateColumns] operation.(<21> Windows SharePoint Services 3.0 and above follow this behavior.)"); } #endregion }
/// <summary> /// This operation is used to perform the following operation on the context site and all child sites within its hierarchy /// <ul> /// <li>Adding one or more specified new columns</li> /// <li>Updating one or more specified existing columns</li> /// <li>Deleting one or more specified existing columns</li> /// </ul> /// </summary> /// <param name="newFields">newFields is an XML element that represents the collection of columns to be added to the context site and all child sites within its hierarchy.</param> /// <param name="updateFields">updateFields is an XML element that represents the collection of columns to be updated on the context site and all child sites within its hierarchy</param> /// <param name="deleteFields">deleteFields is an XML element that represents the collection of columns to be deleted from the context site and all child sites within its hierarchy</param> /// <returns>The result of UpdateColumns.</returns> public UpdateColumnsResponseUpdateColumnsResult UpdateColumns(UpdateColumnsMethod[] newFields, UpdateColumnsMethod1[] updateFields, UpdateColumnsMethod2[] deleteFields) { UpdateColumnsResponseUpdateColumnsResult updateColumnsResponseUpdateColumnsResult = null; updateColumnsResponseUpdateColumnsResult = this.service.UpdateColumns(newFields, updateFields, deleteFields); this.ValidateUpdateColumns(); this.CaptureTransportRelatedRequirements(); return updateColumnsResponseUpdateColumnsResult; }