Example #1
0
        public void TestCase_S14_TC01_AllocateExtendedGuidRange_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Allocate Extended GUID Range
            Compact64bitInt     requestIdCount  = new Compact64bitInt(8000);
            CellSubRequestType  allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount);
            CellStorageResponse response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest });
            CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);

            FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site);

            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site);

            // Extract the Allocate ExtendedGuid Range sub-response info
            this.Site.Assert.IsTrue(fsshttpbResponse.CellSubResponses.Count > 0, "The protocol server should return SubResponse for Allocate ExtendedGuid Range sub-request processing.");
            this.Site.Assert.IsNotNull(fsshttpbResponse.CellSubResponses[0].GetSubResponseData <AllocateExtendedGuidRangeSubResponseData>(), "The protocol server should return SubResponseData for Allocate ExtendedGuid Range sub-request processing.");

            AllocateExtendedGuidRangeSubResponseData allocateResponse = fsshttpbResponse.CellSubResponses[0].GetSubResponseData <AllocateExtendedGuidRangeSubResponseData>();

            // Assert for elements in Allocate Extended Guid Range sub-response
            this.Site.Assert.IsNotNull(allocateResponse.AllocateExtendedGUIDRangeResponse, "The protocol server should return Allocate Extended GUID Range Response.");
            this.Site.Assert.IsNotNull(allocateResponse.GUIDComponent, "The protocol server should allocate ExtendedGuids as requested.");
            this.Site.Assert.IsNotNull(allocateResponse.IntegerRangeMin, "The protocol server should return an integer Range Min in the sub-response.");
            this.Site.Assert.IsNotNull(allocateResponse.IntegerRangeMax, "The protocol server should return an integer Range Max in the sub-response.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTPB requirement: MS-FSSHTTPB_R9005
                Site.CaptureRequirement(
                    "MS-FSSHTTPB",
                    99099,
                    @"[In Appendix B: Product Behavior] The implementation does support this sub-request [Allocate ExtendedGuid Range Sub-Request]( SharePoint Server 2013 and above follow this behavior.)");
            }

            // Allocate Extended GUID Range value less than 1000.
            requestIdCount  = new Compact64bitInt(100);
            allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount);
            response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest });
            cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);
            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);

            // Allocate Extended GUID Range value less than 100000.
            requestIdCount  = new Compact64bitInt(150000);
            allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount);
            response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest });
            cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);
            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);
        }