Microsoft.Protocols.TestSuites.MS_VERSS.S03_ErrorConditions.MSVERSS_S03_TC11_VerifyHTTPFault C# (CSharp) Method

MSVERSS_S03_TC11_VerifyHTTPFault() private method

private MSVERSS_S03_TC11_VerifyHTTPFault ( ) : void
return void
        public void MSVERSS_S03_TC11_VerifyHTTPFault()
        {
            #region upload file to site and create versions.

            // Enable the versioning of the list. 
            bool setVersioning = this.sutControlAdapterInstance.SetVersioning(this.documentLibrary, true, true);
            Site.Assert.IsTrue(
                setVersioning, 
                "SetVersioning operation returns {0}, TRUE means the operation was executed successfully," +
                " FALSE means the operation failed", 
                setVersioning);

            // Upload the file into specific list. 
            bool isAddFileSuccessful =
                this.sutControlAdapterInstance.AddFile(this.documentLibrary, this.fileName, TestSuiteHelper.UploadFileName);
            Site.Assert.IsTrue(
                isAddFileSuccessful,
                "AddFile operation returns {0}, TRUE means the operation was executed successfully," +
                " FALSE means the operation failed", 
                isAddFileSuccessful);

            // Get the relative name of the file. 
            string fileUrl = this.documentLibrary + "/" + this.fileName;

            // Check out and check in file one time to create a new version of the file. 
            this.testSuiteHelper.AddOneFileVersion(this.fileName);

            #endregion

            this.protocolAdapterInstance.InitializeUnauthorizedService();

            try
            {
                this.protocolAdapterInstance.GetVersions(fileUrl);
                Site.Assert.Fail("The GetVersions operation should fail.");
            }
            catch (SoapException ex)
            {
                Site.Assert.Pass("The soap fault is returned, the error information is {0}", ex.Message);
            }
            catch (WebException ex)
            {
                Site.Assert.Pass("The http fault is returned, the error information is {0}", ex.Message);
            }
            finally
            {
                this.protocolAdapterInstance.Initialize(this.Site);
            }
        }
        #endregion