public void TestCase_S07_TC09_EditorsTable_ExceedQuota()
{
if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 9001, this.Site))
{
Site.Assume.Inconclusive("Implementation does not support the editors table.");
}
// Initialize the service
this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);
// Join the editors table using default client id
this.PrepareJoinEditorsTable(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID);
// Add the first Key/value pair.
EditorsTableSubRequestType update = SharedTestSuiteHelper.CreateEditorsTableSubRequestForUpdateSessionMetadata(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.GenerateRandomString(4), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(4)));
CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { update });
EditorsTableSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponse, 0, 0, this.Site);
this.Site.Assert.AreEqual<ErrorCodeType>(
ErrorCodeType.Success,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site),
"Update the editor table with the key {0} and value {1} on the file {2} should succeed.",
update.SubRequestData.Key,
update.SubRequestData.Text[0],
this.DefaultFileUrl);
// Add the second Key/value pair.
EditorsTableSubRequestType update2 = SharedTestSuiteHelper.CreateEditorsTableSubRequestForUpdateSessionMetadata(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.GenerateRandomString(4), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(4)));
CellStorageResponse cellStorageResponse2 = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { update2 });
EditorsTableSubResponseType subResponse2 = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponse2, 0, 0, this.Site);
this.Site.Assert.AreEqual<ErrorCodeType>(
ErrorCodeType.Success,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse2.ErrorCode, this.Site),
"Update the editor table with the key {0} and value {1} on the file {2} should succeed.",
update2.SubRequestData.Key,
update2.SubRequestData.Text[0],
this.DefaultFileUrl);
// Add the third Key/value pair.
EditorsTableSubRequestType update3 = SharedTestSuiteHelper.CreateEditorsTableSubRequestForUpdateSessionMetadata(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.GenerateRandomString(4), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(4)));
CellStorageResponse cellStorageResponse3 = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { update3 });
EditorsTableSubResponseType subResponse3 = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponse3, 0, 0, this.Site);
this.Site.Assert.AreEqual<ErrorCodeType>(
ErrorCodeType.Success,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse3.ErrorCode, this.Site),
"Update the editor table with the key {0} and value {1} on the file {2} should succeed.",
update3.SubRequestData.Key,
update3.SubRequestData.Text[0],
this.DefaultFileUrl);
// Add the fourth Key/value pair.
EditorsTableSubRequestType update4 = SharedTestSuiteHelper.CreateEditorsTableSubRequestForUpdateSessionMetadata(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.GenerateRandomString(4), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(4)));
CellStorageResponse cellStorageResponse4 = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { update4 });
EditorsTableSubResponseType subResponse4 = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponse4, 0, 0, this.Site);
this.Site.Assert.AreEqual<ErrorCodeType>(
ErrorCodeType.Success,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse4.ErrorCode, this.Site),
"Update the editor table with the key {0} and value {1} on the file {2} should succeed.",
update4.SubRequestData.Key,
update4.SubRequestData.Text[0],
this.DefaultFileUrl);
// Add the fifth Key/value pair.
EditorsTableSubRequestType update5 = SharedTestSuiteHelper.CreateEditorsTableSubRequestForUpdateSessionMetadata(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.GenerateRandomString(4), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(4)));
CellStorageResponse cellStorageResponse5 = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { update5 });
EditorsTableSubResponseType subResponse5 = SharedTestSuiteHelper.ExtractSubResponse<EditorsTableSubResponseType>(cellStorageResponse5, 0, 0, this.Site);
if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
{
// If the ErrorCode attribute returned equals "EditorMetadataQuotaReached", then MS-FSSHTTP_R1976,MS-FSSHTTP_R3035 and MS-FSSHTTP_R3031 can be captured.
Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
ErrorCodeType.EditorMetadataQuotaReached,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse5.ErrorCode, this.Site),
"MS-FSSHTTP",
1976,
@"[In Appendix B: Product Behavior] The implementation does return an error code value set to ""EditorMetadataQuotaReached"" for an ""Update editor metadata"" request if the client has already exceeded 4 key/value pairs. (<41> Section 3.1.4.8: Only 4 key/value pairs can be associated with an editor on servers running Office 2013.)");
Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
ErrorCodeType.EditorMetadataQuotaReached,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse5.ErrorCode, this.Site),
"MS-FSSHTTP",
3035,
@"[In NewEditorsTableCategoryErrorCodeTypes] The value ""EditorMetadataQuotaReached"" indicates an error when the client has already exceeded its quota for number of key/value pairs.");
Site.CaptureRequirementIfAreEqual<ErrorCodeType>(
ErrorCodeType.EditorMetadataQuotaReached,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse5.ErrorCode, this.Site),
"MS-FSSHTTP",
3031,
@"[In Appendix B: Product Behavior] Implementation does return NewEditorsTableCategoryErrorCodeTypes when the error occurs during the processing of an EditorsTable subrequest. (Microsoft Office 2013/Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)");
}
else
{
Site.Assert.AreEqual<ErrorCodeType>(
ErrorCodeType.EditorMetadataQuotaReached,
SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse5.ErrorCode, this.Site),
@"[In Appendix B: Product Behavior] The implementation does return an error code value set to ""EditorMetadataQuotaReached"" for an ""Update editor metadata"" request if the client has already exceeded 4 key/value pairs. (<41> Section 3.1.4.8: Only 4 key/value pairs can be associated with an editor on servers running Office 2013.)");
}
}