Microsoft.Protocols.TestSuites.MS_DWSS.S03_ManageFolders.MSDWSS_S03_TC03_CreateFolder_AlreadyExists C# (CSharp) Method

MSDWSS_S03_TC03_CreateFolder_AlreadyExists() private method

private MSDWSS_S03_TC03_CreateFolder_AlreadyExists ( ) : void
return void
        public void MSDWSS_S03_TC03_CreateFolder_AlreadyExists()
        {
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("TestDWSSWebSite", this.Site);
            
            Error error;
            UsersItem users = new UsersItem();
            DocumentsItem documents = new DocumentsItem();
            
            users.Name = Common.GetConfigurationPropertyValue("UserName", this.Site);
            users.Email = Common.GetConfigurationPropertyValue("RegisteredUsersEmail", this.Site);
            
            documents.ID = Guid.NewGuid().ToString();
            documents.Name = Common.GetConfigurationPropertyValue("DocumentsName", this.Site) + "_" + Common.FormatCurrentDateTime();

            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, documents, out error);
            
            // Redirect the web service to the newly created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            // Create a folder in a specified folder URL.
            string folderUrl = Common.GetConfigurationPropertyValue("ValidFolderUrl", this.Site) + "_" + Common.FormatCurrentDateTime();
            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a <Result/>, not an error.");
            
            // Create a folder using the same folder URL, then the server will return a AlreadyExists Error element.
            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected an error.");
            
            // If error is not null, it indicates that the server did returns an Error element as is specified.
            this.Site.CaptureRequirement(
                159,
                @"[In CreateFolderResponse] Error: An Error element as specified in section 2.2.3.2.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R150");
            
            // Verify MS-DWSS requirement: MS-DWSS_R150
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.AlreadyExists,
                error.Value,
                150,
                @"[In CreateFolder] If the specified URL already exists, the protocol server MUST return an Error element with an AlreadyExists error code.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R32");
            
            // Verify MS-DWSS requirement: MS-DWSS_R32
            this.Site.CaptureRequirementIfAreEqual<string>(
                "13",
                error.ID,
                32,
                @"[In Error] The value 13 [ID] matches the Error type AlreadyExists.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R323");
            
            // Verify MS-DWSS requirement: MS-DWSS_R323
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                323,
                @"[In Error] This attribute [AccessUrl] MUST NOT be present when the Error element contains AlreadyExists error code.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }