Microsoft.Protocols.TestSuites.MS_DWSS.S01_ManageSites.MSDWSS_S01_TC06_CreateDws_HTTPError C# (CSharp) Method

MSDWSS_S01_TC06_CreateDws_HTTPError() private method

private MSDWSS_S01_TC06_CreateDws_HTTPError ( ) : void
return void
        public void MSDWSS_S01_TC06_CreateDws_HTTPError()
        {
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("TestDWSSWebSite", this.Site);
            
            // Set Dws service credential to Reader credential.
            string userName = Common.GetConfigurationPropertyValue("ReaderRoleUser", this.Site);
            string password = Common.GetConfigurationPropertyValue("ReaderRoleUserPassword", this.Site);
            string domain = Common.GetConfigurationPropertyValue("Domain", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);
            
            Error error;
            string dwsName = Common.GetConfigurationPropertyValue("SutComputerName", this.Site) + "_" + Common.FormatCurrentDateTime();
            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", this.Site) + "_" + Common.FormatCurrentDateTime();
            
            try
            {
                this.dwsAdapter.CreateDws(dwsName, null, dwsTitle, null, out error);
            
                this.Site.Assert.Fail("The expected HTTP status code 401 is not returned for CreateDws when the authenticated user does not have enough permissions to create the Document WorkSpace.");
            }
            catch (WebException webException)
            {
                if (webException.Response == null)
                {
                    throw;
                }

                // The web exception response must not be null.
                this.Site.Assert.IsNotNull(webException.Response, "The server should return http status code 401, the response must not be null web exception. The actual exception is:{0}", webException.Message);

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R120");
                
                // Verify MS-DWSS requirement: MS-DWSS_R120
                this.Site.CaptureRequirementIfAreEqual<HttpStatusCode>(
                    HttpStatusCode.Unauthorized,
                    ((HttpWebResponse)webException.Response).StatusCode,
                    120,
                    @"[In CreateDws] The protocol server MUST reply with an HTTP 401 error if the authenticated user is not authorized to create the Document Workspace.");
                
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R698");
                
                // Verify MS-DWSS requirement: MS-DWSS_R698
                this.Site.CaptureRequirementIfAreEqual<HttpStatusCode>(
                    HttpStatusCode.Unauthorized,
                    ((HttpWebResponse)webException.Response).StatusCode,
                    698,
                    @"[In Transport] Protocol server faults MUST be returned by using HTTP status codes as specified in [RFC2616] Status Code Definitions section 10 or SOAP faults as specified in [SOAP1.1] SOAP Fault section 4.4 or in [SOAP1.2/1] SOAP Fault section 5.4.");
            }
        }