Microsoft.Protocols.TestSuites.SharedTestSuite.S09_GetVersions.TestCase_S09_TC03_GetVersions_Success_Results_VersioningDiabled C# (CSharp) Method

TestCase_S09_TC03_GetVersions_Success_Results_VersioningDiabled() private method

        public void TestCase_S09_TC03_GetVersions_Success_Results_VersioningDiabled()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);
            if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, false))
            {
                this.Site.Assert.Fail("Cannot disable the version on the document library {0}", documentLibraryName);
            }

            this.StatusManager.RecordDisableVersioning(documentLibraryName);

            // Invoke GetVersions sub-request with the file URL that under a document list whose versioning is disabled.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse<GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);
            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Make sure the error code value in the response equals "Success".
                Site.Assert.AreEqual<ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"The response of the ""getVersions"" sub-request on the file {0} should succeed.",
                    this.DefaultFileUrl);

                // If the value of "versioning enabled" is 0 under "results" element in the sub-response, then capture MS-FSSHTTP_R2304.
                Site.CaptureRequirementIfAreEqual<byte>(
                         0,
                         getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled,
                         "MS-FSSHTTP",
                         2304,
                         @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: A value of ""0"" indicates that versioning is disabled.");
            }
            else
            {
                Site.Assert.AreEqual<byte>(
                    0,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled,
                    @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: A value of ""0"" indicates that versioning is disabled.");
            }
        }