public void MSDWSS_S05_TC01_RemoveDwsUser_RemoveUserSuccessfully()
        {
            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);
            
            // Get first member of the current site.
            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(documents.Name, string.Empty, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a GetDwsDataResult not an error");
            this.Site.Assert.IsNotNull(getDwsDataRespResults.Members.Items, "The server should return a member element.");
            this.Site.Assert.IsTrue(getDwsDataRespResults.Members.Items.Length > 0, "The site members should be more than one.");
            
            Member firstMember = getDwsDataRespResults.Members.Items[0] as Member;
            this.Site.Assert.IsNotNull(firstMember, "The user should exist on server.");
            
            // Remove the first member.
            this.dwsAdapter.RemoveDwsUser(int.Parse(firstMember.ID), out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a Result element not an error");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
        public void MSDWSS_S01_TC10_DeleteDws_DeleteCurrentSiteSuccessfully()
        {
            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);

            // Delete the created web site.
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not contains an error.");

            // If the response isn't an error, it indicate that the server returns a Result element
            this.Site.CaptureRequirement(
                166,
                @"[In DeleteDws] If none of the prior conditions apply, the protocol server MUST delete the specified Document Workspace and return a Result element.");
        }
Exemple #3
0
        public void MSDWSS_S03_TC06_CreateFolder_InvalidParentFolderUrl()
        {
            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 sub folder in the web site.
            string folderUrl = "InvalidParentFolder/MSDWSS_TestFolder";

            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a <Result/>, not an error.");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        /// <summary>
        /// The operation to create a new Document Workspace.
        /// </summary>
        /// <param name="dwsName">Specifies the name of the Document Workspace site, this parameter can be empty.</param>
        /// <param name="users">Specifies the users to be added as contributors in the Document Workspace site, this parameter can be null.</param>
        /// <param name="dwsTitle">Specifies the title of the workspace, this parameter can be empty.</param>
        /// <param name="docs">Specifies information to be stored as a key-value pair in the site metadata, this parameter can be null.</param>
        /// <param name="error">An error indication.</param>
        /// <returns>CreateDws operation response.</returns>
        public CreateDwsResultResults CreateDws(string dwsName, UsersItem users, string dwsTitle, DocumentsItem docs, out Error error)
        {
            // Serialize users object to xml string.
            string usersString = users == null ? string.Empty : AdapterHelper.XmlSerialize(users);

            // Serialize docs object to xml string.
            string docsString = docs == null ? string.Empty : AdapterHelper.XmlSerialize(docs);

            string respString = this.dwsService.CreateDws(dwsName, usersString, dwsTitle, docsString);

            // Decode response standalone xml string.
            string respXmlString = AdapterHelper.GenRespXmlString("CreateDwsResult", respString);

            // Validate response xml schema and capture the related requirements.
            this.ValidateCreateDwsResponseSchema(respXmlString);

            // Capture protocol transport related requirements.
            this.ValidateProtocolTransport();

            // Capture SOAP version related requirements.
            this.ValidateSoapVersion();

            // Deserialize response xml string to CreateDwsResult object.
            CreateDwsResult resp = AdapterHelper.XmlDeserialize <CreateDwsResult>(respXmlString);

            error = resp.Item as Error;

            if (resp.Item is CreateDwsResultResults)
            {
                // Validate the requirements related to Results element in CreateDwsResult element.
                this.ValidateCreateDwsResultResults(usersString, resp.Item as CreateDwsResultResults);
            }

            return(resp.Item as CreateDwsResultResults);
        }
Exemple #5
0
        public void MSDWSS_S05_TC03_RemoveDwsUser_NoAccess()
        {
            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);

            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(documents.Name, string.Empty, out error);

            this.Site.Assert.IsNull(error, "The response is expected to be a GetDwsDataResult not an error");
            this.Site.Assert.IsNotNull(getDwsDataRespResults.Members.Items, "The members not expected to be null");

            // Get first member
            Member firstMember = getDwsDataRespResults.Members.Items[0] as Member;

            this.Site.Assert.IsNotNull(firstMember, "The user should exist on server.");

            // 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);

            this.dwsAdapter.RemoveDwsUser(int.Parse(firstMember.ID), out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be a NoAccess error.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R22");

            // Verify MS-DWSS requirement: MS-DWSS_R22
            bool isVerifiedR22 = string.Equals("3", error.ID, StringComparison.CurrentCultureIgnoreCase) &&
                                 error.Value == ErrorTypes.NoAccess;

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR22,
                22,
                @"[In Error] The value 3 [ID] matches the Error type NoAccess.");

            // Set default Dws service credential to admin credential.
            userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            password = Common.GetConfigurationPropertyValue("Password", this.Site);
            domain   = Common.GetConfigurationPropertyValue("Domain", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
Exemple #6
0
        public void MSDWSS_S03_TC07_DeleteFolder_DeleteFolderSuccessfully()
        {
            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);

            string folderUrl = Common.GetConfigurationPropertyValue("ValidFolderUrl", this.Site) + "_" + Common.FormatCurrentDateTime();

            // If the server creates the folder successfully, then validates that the server can delete the specified folder using the DeleteFolder operation.
            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a <Result/>, not an error.");

            string invalidFolderUrl = "MSDWSS_DocumentLibrary/MSDWSS_NotExistFolder";

            this.dwsAdapter.DeleteFolder(invalidFolderUrl, out error);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R173");

            // Verify MS-DWSS requirement: MS-DWSS_R173
            this.Site.CaptureRequirementIfIsNull(
                error,
                173,
                @"[In DeleteFolder] If the specified URL does not exist, the protocol server MUST return a Result element as specified in DeleteFolderResponse (section 3.1.4.5.2.2).");

            this.dwsAdapter.DeleteFolder(folderUrl, out error);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R177");

            // Verify MS-DWSS requirement: MS-DWSS_R177
            this.Site.CaptureRequirementIfIsNull(
                error,
                177,
                @"[In DeleteFolder] If none of the prior conditions apply, the protocol server MUST delete the folder specified in the CreateFolder element and return a Result element as specified in DeleteDwsResponse (section 3.1.4.5.2.2).");

            // Delete the created folder without url.
            this.dwsAdapter.DeleteFolder(null, out error);
            this.Site.Assert.IsNotNull(error, "The server should return an error.");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S04_TC01_FindDwsDoc_ValidId()
        {
            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();

            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();

            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, dwsTitle, documents, out error);

            // Redirect the web service to the newly created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);

            // Find the document with valid document id.
            string findDwsDocResult = this.dwsAdapter.FindDwsDoc(documents.ID, out error);

            this.Site.Assert.IsNull(error, "The response should not be an error!");

            Uri uriAddress = new Uri(findDwsDocResult);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R536");

            // Verify MS-DWSS requirement: MS-DWSS_R536
            this.Site.CaptureRequirementIfIsTrue(
                uriAddress.IsAbsoluteUri,
                536,
                @"[In FindDwsDocResponse] Result: A Result element for which the content MUST be an absolute URL that refers to the requested document.");

            if (Common.IsRequirementEnabled(687, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R687");

                // Verify MS-DWSS requirement: MS-DWSS_R687
                this.Site.CaptureRequirementIfIsTrue(
                    uriAddress.IsAbsoluteUri,
                    687,
                    @"[In Appendix B: Product Behavior] Implementation does reply with a Result element as specified in FindDwsDocResponse containing an absolute URL to the specified document. (Windows® SharePoint® Services 3.0 and above products follow this behavior.)");
            }

            // Find the document without document id.
            this.dwsAdapter.FindDwsDoc(null, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error!");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
        public void MSDWSS_S04_TC01_FindDwsDoc_ValidId()
        {
            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();

            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();

            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, dwsTitle, documents, out error);
            
            // Redirect the web service to the newly created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            // Find the document with valid document id.
            string findDwsDocResult = this.dwsAdapter.FindDwsDoc(documents.ID, out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");

            Uri uriAddress = new Uri(findDwsDocResult);
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R536");
            
            // Verify MS-DWSS requirement: MS-DWSS_R536
            this.Site.CaptureRequirementIfIsTrue(
                uriAddress.IsAbsoluteUri,
                536,
                @"[In FindDwsDocResponse] Result: A Result element for which the content MUST be an absolute URL that refers to the requested document.");
            
            if (Common.IsRequirementEnabled(687, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R687");
                
                // Verify MS-DWSS requirement: MS-DWSS_R687
                this.Site.CaptureRequirementIfIsTrue(
                    uriAddress.IsAbsoluteUri,
                    687,
                    @"[In Appendix B: Product Behavior] Implementation does reply with a Result element as specified in FindDwsDocResponse containing an absolute URL to the specified document. (Windows® SharePoint® Services 3.0 and above products follow this behavior.)");
            }
            
            // Find the document without document id.
            this.dwsAdapter.FindDwsDoc(null, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error!");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
        public void MSDWSS_S01_TC08_RenameDws_ValidTitle()
        {
            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();

            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();
            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, dwsTitle, documents, out error);

            // Redirect the web service to the newly created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);

            string dwsNewTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();

            this.dwsAdapter.RenameDws(dwsNewTitle, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");

            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(documents.Name, string.Empty, out error);

            this.Site.Assert.IsNull(error, "The server should not return an error!");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R554");

            // Verify MS-DWSS requirement: MS-DWSS_R554
            this.Site.CaptureRequirementIfAreEqual <string>(
                dwsNewTitle,
                getDwsDataRespResults.Title,
                554,
                @"[In GetDwsDataResponse] Title: The title of the workspace.");

            // Rename Document Workspace without title.
            this.dwsAdapter.RenameDws(null, out error);
            this.Site.Assert.IsNotNull(error, "The server should return an error!");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
Exemple #10
0
        public void MSDWSS_S05_TC01_RemoveDwsUser_RemoveUserSuccessfully()
        {
            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);

            // Get first member of the current site.
            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(documents.Name, string.Empty, out error);

            this.Site.Assert.IsNull(error, "The response is expected to be a GetDwsDataResult not an error");
            this.Site.Assert.IsNotNull(getDwsDataRespResults.Members.Items, "The server should return a member element.");
            this.Site.Assert.IsTrue(getDwsDataRespResults.Members.Items.Length > 0, "The site members should be more than one.");

            Member firstMember = getDwsDataRespResults.Members.Items[0] as Member;

            this.Site.Assert.IsNotNull(firstMember, "The user should exist on server.");

            // Remove the first member.
            this.dwsAdapter.RemoveDwsUser(int.Parse(firstMember.ID), out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a Result element not an error");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
Exemple #11
0
        public void MSDWSS_S03_TC01_CreateFolder_CreateFolderSuccessfully()
        {
            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 sub folder in the web site.
            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.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R155");

            // Verify MS-DWSS requirement: MS-DWSS_R155
            this.Site.CaptureRequirementIfIsNull(
                error,
                155,
                @"[In CreateFolder] If none of the prior conditions [FolderNotFound, AlreadyExists, NoAccess, Failed or ServerFailure] apply, the protocol server MUST create the folder specified in the CreateFolder element.");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S03_TC01_CreateFolder_CreateFolderSuccessfully()
        {
            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 sub folder in the web site.
            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.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R155");
            
            // Verify MS-DWSS requirement: MS-DWSS_R155
            this.Site.CaptureRequirementIfIsNull(
                error,
                155,
                @"[In CreateFolder] If none of the prior conditions [FolderNotFound, AlreadyExists, NoAccess, Failed or ServerFailure] apply, the protocol server MUST create the folder specified in the CreateFolder element.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC04_CreateDws_EmptyNameAndEmptyTitle()
        {
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("TestDWSSWebSite", this.Site);
            
            Error error;
            UsersItem users = new UsersItem();
            
            // construct an invalid user
            users.Name = "invalidUser";
            users.Email = "invalidUserEmail";
            
            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, null, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a CreateDwsResult, not an error!");
            
            // Get last element
            string newCreatedDwsName = createDwsRespResults.Url.Substring(createDwsRespResults.Url.LastIndexOf('/') + 1);
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R467, the new unique GUID server generated is {0}.", newCreatedDwsName);

            Guid dwsName;
            
            // Verify MS-DWSS requirement: MS-DWSS_R467
            this.Site.CaptureRequirementIfIsTrue(
                Guid.TryParse(newCreatedDwsName, out dwsName),
                467,
                @"[In CreateDws] If the name and title parameters are empty, the protocol server MUST generate a new unique GUID to use as the name of the new workspace.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R475");
            
            // Verify MS-DWSS requirement: MS-DWSS_R475
            Uri listUri;
            bool isVerifiedR475 = Uri.TryCreate(createDwsRespResults.DoclibUrl, UriKind.Relative, out listUri);
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR475,
                475,
                @"[In CreateDwsResponse] DoclibUrl: Site-relative URL for the shared documents list associated with the workspace.");
            
            // Get the title of the parent site.
            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(string.Empty, string.Empty, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R476");
            
            // Verify MS-DWSS requirement: MS-DWSS_R476
            this.Site.CaptureRequirementIfAreEqual<string>(
                getDwsDataRespResults.Title,
                createDwsRespResults.ParentWeb,
                476,
                @"[In CreateDwsResponse] ParentWeb: Title of the site (2) on which the workspace is created.");
            
            this.Site.Assert.IsNotNull(createDwsRespResults.FailedUsers, "The server should return the FailedUsers element.");
            this.Site.Assert.IsTrue(createDwsRespResults.FailedUsers.Length > 0, "The failed users is expected to be more than one.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R478");
            
            // Verify MS-DWSS requirement: MS-DWSS_R478
            this.Site.CaptureRequirementIfAreEqual<string>(
                users.Email,
                createDwsRespResults.FailedUsers[0].User.Email,
                478,
                @"[In CreateDwsResponse] FailedUsers: A list of users from the users field of CreateDws that could not be added to the list of authorized users in the new workspace.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R479");
            
            // Verify MS-DWSS requirement: MS-DWSS_R479
            Uri addUsersUrl;
            bool isVerifiedR479 = Uri.TryCreate(createDwsRespResults.AddUsersUrl, UriKind.Absolute, out addUsersUrl);
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR479,
                479,
                @"[In CreateDwsResponse] AddUsersUrl: An absolute URL to a Web page that provides the ability to add users to the workspace.");
            
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S05_TC02_RemoveDwsUser_ServerFailure()
        {
            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);
            
            int invalidUserId = -1;
            this.dwsAdapter.RemoveDwsUser(invalidUserId, out error);
            this.Site.Assert.IsNotNull(error, "The expected response is an error.");
            
            // If the error is not null, it indicates that the server returned an Error element as is specified.
            this.Site.CaptureRequirement(
                289,
                @"[In RemoveDwsUserResponse] 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_R286");
            
            // Verify MS-DWSS requirement: MS-DWSS_R286
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                286,
                @"[In RemoveDwsUser] If an error of any type occurs during the processing, the protocol server MUST return an Error element as specified in section 2.2.3.2 with an error code of ServerFailure.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R20");
            
            // Verify MS-DWSS requirement: MS-DWSS_R20
            this.Site.CaptureRequirementIfAreEqual<string>(
                "1",
                error.ID,
                20,
                @"[In Error] The value 1 [ID] matches the Error type ServerFailure.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R312");
            
            // Verify MS-DWSS requirement: MS-DWSS_R312
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                312,
                @"[In Error] This attribute [AccessUrl] MUST NOT be present when the Error element contains ServerFailure error code.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
Exemple #15
0
        public void MSDWSS_S05_TC02_RemoveDwsUser_ServerFailure()
        {
            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);

            int invalidUserId = -1;

            this.dwsAdapter.RemoveDwsUser(invalidUserId, out error);
            this.Site.Assert.IsNotNull(error, "The expected response is an error.");

            // If the error is not null, it indicates that the server returned an Error element as is specified.
            this.Site.CaptureRequirement(
                289,
                @"[In RemoveDwsUserResponse] 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_R286");

            // Verify MS-DWSS requirement: MS-DWSS_R286
            this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                286,
                @"[In RemoveDwsUser] If an error of any type occurs during the processing, the protocol server MUST return an Error element as specified in section 2.2.3.2 with an error code of ServerFailure.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R20");

            // Verify MS-DWSS requirement: MS-DWSS_R20
            this.Site.CaptureRequirementIfAreEqual <string>(
                "1",
                error.ID,
                20,
                @"[In Error] The value 1 [ID] matches the Error type ServerFailure.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R312");

            // Verify MS-DWSS requirement: MS-DWSS_R312
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                312,
                @"[In Error] This attribute [AccessUrl] MUST NOT be present when the Error element contains ServerFailure error code.");

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }
Exemple #16
0
        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!");
        }
        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!");
        }
        public void MSDWSS_S03_TC06_CreateFolder_InvalidParentFolderUrl()
        {
            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 sub folder in the web site.
            string folderUrl = "InvalidParentFolder/MSDWSS_TestFolder";
            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a <Result/>, not an error.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC13_DeleteDws_NoAccess()
        {
            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);

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);

            // Set Dws service credential to Reader credential which does not have sufficient rights.
            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);

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R162");

            // Verify MS-DWSS requirement: MS-DWSS_R162
            this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                ErrorTypes.NoAccess,
                error.Value,
                162,
                @"[In DeleteDws] The protocol server MUST return an Error element with a NoAccess code if the authenticated user is not authorized to delete the Document Workspace.");

            // Set Dws service credential to a user who has sufficient permission to call DeleteDws operation.
            userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            password = Common.GetConfigurationPropertyValue("Password", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);

            // Redirect the web service to the site collection without sub sites.
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("SiteCollectionWithoutSubSite", this.Site);

            // Try to delete the site collection.
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R499");

            // Verify MS-DWSS requirement: MS-DWSS_R499
            this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                499,
                @"[In DeleteDws] If the specified Document Workspace is the root site of the site collection, the protocol server MUST return an Error element with the ServerFailure error code.");

            // Redirect the web service to the created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S03_TC07_DeleteFolder_DeleteFolderSuccessfully()
        {
            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);

            string folderUrl = Common.GetConfigurationPropertyValue("ValidFolderUrl", this.Site) + "_" + Common.FormatCurrentDateTime();
            
            // If the server creates the folder successfully, then validates that the server can delete the specified folder using the DeleteFolder operation.
            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a <Result/>, not an error.");
            
            string invalidFolderUrl = "MSDWSS_DocumentLibrary/MSDWSS_NotExistFolder";
            this.dwsAdapter.DeleteFolder(invalidFolderUrl, out error);
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R173");
            
            // Verify MS-DWSS requirement: MS-DWSS_R173
            this.Site.CaptureRequirementIfIsNull(
                error,
                173,
                @"[In DeleteFolder] If the specified URL does not exist, the protocol server MUST return a Result element as specified in DeleteFolderResponse (section 3.1.4.5.2.2).");

            this.dwsAdapter.DeleteFolder(folderUrl, out error);
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R177");
            
            // Verify MS-DWSS requirement: MS-DWSS_R177
            this.Site.CaptureRequirementIfIsNull(
                error,
                177,
                @"[In DeleteFolder] If none of the prior conditions apply, the protocol server MUST delete the folder specified in the CreateFolder element and return a Result element as specified in DeleteFolderResponse (section 3.1.4.5.2.2).");
            
            // Delete the created folder without url.
            this.dwsAdapter.DeleteFolder(null, out error);
            this.Site.Assert.IsNotNull(error, "The server should return an error.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC04_CreateDws_EmptyNameAndEmptyTitle()
        {
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("TestDWSSWebSite", this.Site);

            Error     error;
            UsersItem users = new UsersItem();

            // construct an invalid user
            users.Name  = "invalidUser";
            users.Email = "invalidUserEmail";

            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, null, out error);

            this.Site.Assert.IsNull(error, "The response is expected to be a CreateDwsResult, not an error!");

            // Get last element
            string newCreatedDwsName = createDwsRespResults.Url.Substring(createDwsRespResults.Url.LastIndexOf('/') + 1);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R467, the new unique GUID server generated is {0}.", newCreatedDwsName);

            Guid dwsName;

            // Verify MS-DWSS requirement: MS-DWSS_R467
            this.Site.CaptureRequirementIfIsTrue(
                Guid.TryParse(newCreatedDwsName, out dwsName),
                467,
                @"[In CreateDws] If the name and title parameters are empty, the protocol server MUST generate a new unique GUID to use as the name of the new workspace.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R475");

            // Verify MS-DWSS requirement: MS-DWSS_R475
            Uri  listUri;
            bool isVerifiedR475 = Uri.TryCreate(createDwsRespResults.DoclibUrl, UriKind.Relative, out listUri);

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR475,
                475,
                @"[In CreateDwsResponse] DoclibUrl: Site-relative URL for the shared documents list (1) associated with the workspace.");

            // Get the title of the parent site.
            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(string.Empty, string.Empty, out error);

            this.Site.Assert.IsNull(error, "The server should not return an error!");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R476");

            // Verify MS-DWSS requirement: MS-DWSS_R476
            this.Site.CaptureRequirementIfAreEqual <string>(
                getDwsDataRespResults.Title,
                createDwsRespResults.ParentWeb,
                476,
                @"[In CreateDwsResponse] ParentWeb: Title of the site (2) on which the workspace is created.");

            this.Site.Assert.IsNotNull(createDwsRespResults.FailedUsers, "The server should return the FailedUsers element.");
            this.Site.Assert.IsTrue(createDwsRespResults.FailedUsers.Length > 0, "The failed users is expected to be more than one.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R478");

            // Verify MS-DWSS requirement: MS-DWSS_R478
            this.Site.CaptureRequirementIfAreEqual <string>(
                users.Email,
                createDwsRespResults.FailedUsers[0].User.Email,
                478,
                @"[In CreateDwsResponse] FailedUsers: A list of users from the CreateDws Users field that could not be added to the list of authorized users in the new workspace.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R479");

            // Verify MS-DWSS requirement: MS-DWSS_R479
            Uri  addUsersUrl;
            bool isVerifiedR479 = Uri.TryCreate(createDwsRespResults.AddUsersUrl, UriKind.Absolute, out addUsersUrl);

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR479,
                479,
                @"[In CreateDwsResponse] AddUsersUrl: An absolute URL to a Web page that provides the ability to add users to the workspace.");

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S02_TC06_GetDwsMetaData_MinimalIsFalse()
        {
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("TestDWSSWebSite", this.Site);
            
            Error error;
            string docUrl = Common.GetConfigurationPropertyValue("ValidDocumentUrl", this.Site);
            string docId = Guid.NewGuid().ToString();
            
            GetDwsMetaDataResultTypeResults getDwsMetaDataResult1 = this.dwsAdapter.GetDwsMetaData(docUrl, docId, false, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R602");
            
            // Verify MS-DWSS requirement: MS-DWSS_R602
            Uri settingUrl;
            bool isVerifiedR602 = Uri.TryCreate(getDwsMetaDataResult1.SettingUrl, UriKind.RelativeOrAbsolute, out settingUrl);
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR602,
                602,
                @"[In GetDwsMetaDataResponse] SettingUrl: URI of a page that enables workspace settings to be modified.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R603");
            
            // Verify MS-DWSS requirement: MS-DWSS_R603
            Uri permsUrl;
            bool isVerifiedR603 = Uri.TryCreate(getDwsMetaDataResult1.PermsUrl, UriKind.RelativeOrAbsolute, out permsUrl);
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR603,
                603,
                @"[In GetDwsMetaDataResponse] PermsUrl: URI of a page that enables the workspace permissions settings to be modified.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R604");
            
            // Verify MS-DWSS requirement: MS-DWSS_R604
            Uri userInfoUrl;
            bool isVerifiedR604 = Uri.TryCreate(getDwsMetaDataResult1.UserInfoUrl, UriKind.RelativeOrAbsolute, out userInfoUrl);
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR604,
                604,
                @"[In GetDwsMetaDataResponse] UserInfoUrl: URI of a page that enables the list of users to be modified.");
            
            this.Site.Assert.IsNotNull(getDwsMetaDataResult1.ListInfo, "The server should return ListInfo element.");
            this.Site.Assert.IsTrue(getDwsMetaDataResult1.ListInfo.Length == 3, "The server should return 3 ListInfo elements");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R587");
            
            // Verify MS-DWSS requirement: MS-DWSS_R587
            this.Site.CaptureRequirementIfAreEqual<string>(
                "Tasks",
                getDwsMetaDataResult1.ListInfo[0].Name,
                587,
                @"[In GetDwsMetaData] If [Minimal is] false, the protocol server MUST return the following elements:
                    From the GetDwsMetaData Results element:
                        ListInfo (Tasks)");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R588");
            
            // Verify MS-DWSS requirement: MS-DWSS_R588
            this.Site.CaptureRequirementIfAreEqual<string>(
                "Documents",
                getDwsMetaDataResult1.ListInfo[1].Name,
                588,
                @"[In GetDwsMetaData] If [Minimal is] false, the protocol server MUST return the following elements:
                    From the GetDwsMetaData Results element:
                        ListInfo (Documents)");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R589");
            
            // Verify MS-DWSS requirement: MS-DWSS_R589
            this.Site.CaptureRequirementIfAreEqual<string>(
                "Links",
                getDwsMetaDataResult1.ListInfo[2].Name,
                589,
                @"[In GetDwsMetaData] If [Minimal is] false, the protocol server MUST return the following elements:
                    From the GetDwsMetaData Results element:
                        ListInfo (Links)");
            
            // If R587, R588, R589 are verified, it indicates that the Name attribute does contains the name of the list.
            this.Site.CaptureRequirement(
                634,
                @"[In ListInfo] Name: Contains the name of the list.");

            this.Site.Assert.IsFalse(getDwsMetaDataResult1.ListInfo[1].Items[0] is Error && getDwsMetaDataResult1.ListInfo[1].Items.Length > 1, "The Document ListInfo should not be an Error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R628");
            
            // Verify MS-DWSS requirement: MS-DWSS_R628
            ListInfoListPermissions listPermissions = getDwsMetaDataResult1.ListInfo[1].Items[1] as ListInfoListPermissions;
            bool isVerifiedR628 = listPermissions.DeleteListItems != null &&
                                  listPermissions.EditListItems != null &&
                                  listPermissions.InsertListItems != null &&
                                  listPermissions.ManageLists != null;
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR628,
                628,
                @"[In ListInfo] The following elements MUST be present if, and only if, the user has that permission: InsertListIems, EditListItems, DeleteListItems, and ManageLists.");
            
            // If R628 is verified, it indicates that the ListPermissions element does displays the current user permissions.
            this.Site.CaptureRequirement(
                627,
                @"[In ListInfo] ListPermissions: This element displays the current user permissions that are associated with the list.");
            
            // If R628 is verified, it indicates that the user does have permission to add new items.
            this.Site.CaptureRequirement(
                629,
                @"[In ListInfo] InsertListItems: Specifies that the current user can add new items to the list.");
            
            // If R628 is verified, it indicates that the user does have permission to edit list items.
            this.Site.CaptureRequirement(
                630,
                @"[In ListInfo] EditListItems: Specifies that the current user can edit list items.");
            
            // If R628 is verified, it indicates that the user does have permission to delete list item.
            this.Site.CaptureRequirement(
                631,
                @"[In ListInfo] DeleteListItems: Specifies that the current user can delete list items.");
            
            // If R628 is verified, it indicates that the user does have permission to manage the list.
            this.Site.CaptureRequirement(
                632,
                @"[In ListInfo] ManageLists: Specifies that the current user can manage the list.");
            
            if (Common.IsRequirementEnabled(689, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R689");
                
                // Verify MS-DWSS requirement: MS-DWSS_R689
                this.Site.CaptureRequirementIfAreEqual(
                    string.Empty,
                    getDwsMetaDataResult1.MtgInstance,
                    689,
                    @"[In Appendix B: Product Behavior] Implementation does return a GetDwsMetaData response in which MtgInstance element value is an empty string. (Windows® SharePoint® Services 3.0 and above products follow this behavior.)");
            }
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R583");
            
            // Verify MS-DWSS requirement: MS-DWSS_R583
            this.Site.CaptureRequirementIfIsFalse(
                string.IsNullOrEmpty(getDwsMetaDataResult1.SubscribeUrl),
                583,
                @"[In GetDwsMetaData] If [Minimal is] false, the protocol server MUST return the following elements:
                From the GetDwsMetaData Results element:
                    SubscribeUrl");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R611");
            
            // Verify MS-DWSS requirement: MS-DWSS_R611
            this.Site.Assert.IsNotNull(getDwsMetaDataResult1.HasUniquePerm, "The server should return the HasUniquePerm element");
            XmlNode[] hasUniquePerm = (XmlNode[])getDwsMetaDataResult1.HasUniquePerm;
            this.Site.Assert.IsTrue(hasUniquePerm.Length > 0, "The HasUniquePerm value is expected to be False or True, it should not be empty.");
                
            this.Site.CaptureRequirementIfAreEqual<string>(
                "True",
                hasUniquePerm[0].Value,
                611,
                @"[In GetDwsMetaDataResponse] HasUniquePerm: Set to True if, and only if, the workspace has custom role assignments.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R270");
            
            // Verify MS-DWSS requirement: MS-DWSS_R270
            this.Site.Assert.IsNotNull(getDwsMetaDataResult1.WorkspaceType, "The server should return the WorkspaceType element");
            XmlNode[] workspaceType = (XmlNode[])getDwsMetaDataResult1.WorkspaceType;
            this.Site.Assert.IsTrue(workspaceType.Length > 0, "The WorkspaceType should have value.");
                                  
            bool isVerifiedR270 = string.Equals("DWS", workspaceType[0].Value, StringComparison.CurrentCulture) ||
                                  string.Equals("MWS", workspaceType[0].Value, StringComparison.CurrentCulture) ||
                                  string.IsNullOrEmpty(workspaceType[0].Value);
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR270,
                270,
                @"[In GetDwsMetaDataResponse] WorkspaceType: This value MUST be ""DWS"", ""MWS"", or an empty string.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R617");
            
            // Verify MS-DWSS requirement: MS-DWSS_R617
            this.Site.Assert.IsNotNull(getDwsMetaDataResult1.IsADMode, "The server should return an IsADMode element");
            XmlNode[] isADMode = (XmlNode[])getDwsMetaDataResult1.IsADMode;
            this.Site.Assert.IsTrue(isADMode.Length > 0, "The IsADMode value should be True or False, it should not be empty.");
                
            this.Site.CaptureRequirementIfAreEqual<string>(
                "False",
                isADMode[0].Value,
                617,
                @"[In GetDwsMetaDataResponse] IsADMode: Set to FALSE if, and only if, the workspace is not set to Active Directory mode, that is, a mode in which new site members are not created in Active Directory Domain Services (AD DS).");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R281");
            
            // Verify MS-DWSS requirement: MS-DWSS_R281
            this.Site.Assert.IsNotNull(getDwsMetaDataResult1.Minimal, "The server should return an Minimal element.");
            XmlNode[] minimal = (XmlNode[])getDwsMetaDataResult1.Minimal;
            this.Site.Assert.IsTrue(minimal.Length > 0, "The Minimal value should be True or False, it should not be empty.");
                
            this.Site.CaptureRequirementIfAreEqual<string>(
                "False",
                minimal[0].Value,
                281,
                @"[In GetDwsMetaDataResponse] This value [Minimal] MUST match the value in the request.");
            
            // If R281 is verified, it indicates that the Minimal match the minimal flag from the GetDwsMetaData request.
            this.Site.CaptureRequirement(
                280,
                @"[In GetDwsMetaDataResponse] Minimal: This element contains the minimal flag from the GetDwsMetaData request.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R282");
            
            // Verify MS-DWSS requirement: MS-DWSS_R282
            // If item is not null, it indicates that the GetDwsDataResult element does contain Result element.
            this.Site.CaptureRequirementIfIsNotNull(
                getDwsMetaDataResult1.Results,
                282,
                @"[In GetDwsMetaDataResponse] Results: This element is identical to Results element of the GetDwsDataResult element specified in section 3.1.4.7.2.2.");
            
            // Create another workspace.
            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 new created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            // Retrieve the current SUT version
            string sutVersion = Common.GetConfigurationPropertyValue("SutVersion", Site);
            string baseUrl = createDwsRespResults.Url;
            
            // Add the "Tasks", "Documents" and "Links" list in the new created workspace.
            bool isAddTasksList = this.sutControlAdapterInstance.AddList("Tasks", 107, baseUrl);
            this.Site.Assert.IsTrue(isAddTasksList, "Failed to add the Tasks list.");
            
            bool isAddLinksList = this.sutControlAdapterInstance.AddList("Links", 103, baseUrl);
            this.Site.Assert.IsTrue(isAddLinksList, "Failed to add the Links list.");

            // The documents list name in MOSS15 and WSS15 is "Documents".
            if (string.Equals(sutVersion, "SharePointFoundation2013") || string.Equals(sutVersion, "SharePointServer2013") || string.Equals(sutVersion, "SharePointServer2016"))
            {
                bool isAddDocList = this.sutControlAdapterInstance.AddList("Documents", 101, baseUrl);
                this.Site.Assert.IsTrue(isAddDocList, "Failed to add the Documents list.");
            }
            else
            {
                bool isAddDocList = this.sutControlAdapterInstance.AddList("Shared Documents", 101, baseUrl);
                this.Site.Assert.IsTrue(isAddDocList, "Failed to add the Shared Documents list.");
            }

            this.dwsAdapter.IsListAdded = true;
            GetDwsMetaDataResultTypeResults getDwsMetaDataResult2 = this.dwsAdapter.GetDwsMetaData(docUrl, docId, false, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error.");

            this.Site.Assert.IsNotNull(getDwsMetaDataResult2.Schema, "The server should return Schema elements.");
            
            bool isVerifiedR584 = false;
            bool isVerifiedR585 = false;
            bool isVerifiedR586 = false;
            
            foreach (Schema schema in getDwsMetaDataResult2.Schema)
            {
                // If the current schema name is "Tasks", R584 is verified.
                if (string.Equals("Tasks", schema.Name, StringComparison.CurrentCulture))
                {
                    isVerifiedR584 = true;
                    continue;
                }
                
                // If the current schema name is "Documents", R585 is verified.
                if (string.Equals("Documents", schema.Name, StringComparison.CurrentCulture))
                {
                    isVerifiedR585 = true;
                    continue;
                }
                
                // If the current schema name is "Links", R586 is verified.
                if (string.Equals("Links", schema.Name, StringComparison.CurrentCulture))
                {
                    isVerifiedR586 = true;
                    continue;
                }
            }
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R584");
            
            // Verify MS-DWSS requirement: MS-DWSS_R584
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR584,
                584,
                @"[In GetDwsMetaData] If [Minimal is] false and the workspace that document belongs to contains a Tasks list, the protocol server will return the Schema (Tasks) element[, and otherwise not].");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R585");
            
            // Verify MS-DWSS requirement: MS-DWSS_R585
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR585,
                585,
                @"[In GetDwsMetaData] If [Minimal is] false and the workspace that document belongs to contains a DocumentLibrary list, the protocol server will return the Schema (Documents) element[, and otherwise not].");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R586");
            
            // Verify MS-DWSS requirement: MS-DWSS_R586
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR586,
                586,
                @"[In GetDwsMetaData] If [Minimal is] false and the workspace that document belongs to contains a Links list, the protocol server will return the Schema (Links) element[, and otherwise not].");
            
            // Delete the "Tasks", "Documents" and "Links" list if there's any in the new created workspace.
            bool isDeleteTasksList = this.sutControlAdapterInstance.DeleteList("Tasks", baseUrl);
            this.Site.Assert.IsTrue(isDeleteTasksList, "Failed to delete the Tasks List.");
            
            bool isDeleteLinksList = this.sutControlAdapterInstance.DeleteList("Links", baseUrl);
            this.Site.Assert.IsTrue(isDeleteLinksList, "Failed to delete the Links List.");
            
            // The documents list name in MOSS15 and WSS15 is "Documents".
            if (string.Equals(sutVersion, "SharePointFoundation2013") || string.Equals(sutVersion, "SharePointServer2013") || string.Equals(sutVersion, "SharePointServer2016"))
            {
                bool isDeleteDocList = this.sutControlAdapterInstance.DeleteList("Documents", baseUrl);
                this.Site.Assert.IsTrue(isDeleteDocList, "Failed to delete the Documents List.");
            }
            else
            {
                bool isDeleteDocList = this.sutControlAdapterInstance.DeleteList("Shared Documents", baseUrl);
                this.Site.Assert.IsTrue(isDeleteDocList, "Failed to delete the Documents List.");
            }

            this.dwsAdapter.IsListAdded = false;
            GetDwsMetaDataResultTypeResults getDwsMetaDataResult3 = this.dwsAdapter.GetDwsMetaData(docUrl, docId, false, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R7072");
            
            // Verify MS-DWSS requirement: MS-DWSS_R7072
            // If the Schema is null, it indicates that the server didn't return the Schema element.
            this.Site.CaptureRequirementIfIsNull(
                getDwsMetaDataResult3.Schema,
                7072,
                @"[In GetDwsMetaData] If [Minimal is] false and the the workspace that document belongs to doesn't contain a Tasks list, the protocol server won't return the Schema (Tasks) element.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R7082");
            
            // Verify MS-DWSS requirement: MS-DWSS_R7082
            // If the Schema is null, it indicates that the server didn't return the Schema element.
            this.Site.CaptureRequirementIfIsNull(
                getDwsMetaDataResult3.Schema,
                7082,
                @"[In GetDwsMetaData] If [Minimal is] false and the workspace that document belongs to doesn't contain a DocumentLibrary list, the protocol server won't return the Schema (Documents) element.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R7092");
            
            // Verify MS-DWSS requirement: MS-DWSS_R7092
            // If the Schema is null, it indicates that the server didn't return the Schema element.
            this.Site.CaptureRequirementIfIsNull(
                getDwsMetaDataResult3.Schema,
                7092,
                @"[In GetDwsMetaData] If [Minimal is] false and the workspace that document belongs to doesn't contain a Links list, the protocol server won't return the Schema (Links) element.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S02_TC12_UpdateDwsData_ServerFailure()
        {
            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);

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            // Update Dws data with updates and meetingInstance set to empty string.
            this.dwsAdapter.UpdateDwsData(string.Empty, string.Empty, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be a ServerFailure error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R303");
            
            // Verify MS-DWSS requirement: MS-DWSS_R303
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                303,
                @"[In UpdateDwsData] If there is a failure during processing of this operation, the protocol server MUST return a ServerFailure error, as specified in section 2.2.3.2.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R673");
            
            // Verify MS-DWSS requirement: MS-DWSS_R673
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                673,
                @"[In UpdateDwsDataResponse] If there is a failure during processing of the operation, , it MUST contain a ServerFailure error, as specified in section 2.2.3.2.");
            
            // Update Document Workspace data without updates and meetingInstance.
            this.dwsAdapter.UpdateDwsData(null, null, out error);
            this.Site.Assert.IsNotNull(error, "The server should return an error.");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S02_TC04_GetDwsMetaData_DocumentNotFound()
        {
            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 new created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);

            string folderUrl = Common.GetConfigurationPropertyValue("ValidFolderUrl", this.Site) + "_" + Common.FormatCurrentDateTime();
            
            // Create a folder in the web site.
            this.dwsAdapter.CreateFolder(folderUrl, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a <Result/>, not an error.");

            string docUrl = Common.GetConfigurationPropertyValue("ValidDocumentUrl", this.Site);
            
            // Get the metaData of the DWS; however, no document exists under the subfolder in the web site.
            this.dwsAdapter.GetDwsMetaData(docUrl, documents.ID, false, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error");
            
            // If the error is not null, it indicates that the server returns an Error element as is specified.
            this.Site.CaptureRequirement(
                596,
                @"[In GetDwsMetaDataResponse] If the element is an Error, it[GetDwsMetaDataResult] MUST contain an error code as specified in section 2.2.3.2.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R28");
            
            // Verify MS-DWSS requirement: MS-DWSS_R28
            this.Site.CaptureRequirementIfAreEqual<string>(
                "9",
                error.ID,
                28,
                @"[In Error] The value 9 [ID] matches the Error type DocumentNotFound.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R704");
            
            // Verify MS-DWSS requirement: MS-DWSS_R704
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.DocumentNotFound,
                error.Value,
                704,
                @"[In MemberData] Error MUST be used when there is a DocumentNotFound issue.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R319");
            
            // Verify MS-DWSS requirement: MS-DWSS_R319
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                319,
                @"[In Error] This attribute [AccessUrl] MUST NOT be present when the Error element contains DocumentNotFound error code.");
            
            // If the above condition are met, the server does returns a DocumentNotFound error.
            this.Site.CaptureRequirement(
                597,
                @"[In GetDwsMetaDataResponse] It[GetDwsMetaDataResult] MUST contain one of the error codes from the following table: [NoAccess, DocumentNotFound, ServerFailure].");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC07_CreateDws_ServerFailure()
        {
            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();

            string dwsName = Common.GetConfigurationPropertyValue("SutComputerName", this.Site) + "_" + Common.FormatCurrentDateTime();
            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", this.Site) + "_" + Common.FormatCurrentDateTime();
            
            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(dwsName, users, dwsTitle, documents, out error);
            this.Site.Assert.IsNotNull(createDwsRespResults, "The server should return a CreateDws response!");
            
            // Set the name to the name returned by CreateDws operation.
            this.dwsAdapter.CreateDws(dwsName, users, dwsTitle, documents, out error);
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R121");
            
            // Verify MS-DWSS requirement: MS-DWSS_R121
            this.Site.CaptureRequirementIfIsNotNull(
                error,
                121,
                @"[In CreateDws] The protocol server MUST reply with an Error element in the CreateDwsResponse response message if it fails to create the specified Document Workspace.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R682");
            
            // Verify MS-DWSS requirement: MS-DWSS_R682
            this.Site.CaptureRequirementIfIsNotNull(
                error,
                682,
                @"[In CreateDws] The protocol server MUST return a CreateDwsResponse response message with an Error element.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R458");
            
            // Verify MS-DWSS requirement: MS-DWSS_R458
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                458,
                @"[In CreateDws] If this is non-empty and another site with the same name already exists on the site on which the workspace is being created, the protocol server MUST return a ServerFailure error code (see section 2.2.3.2).");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R485");
            
            // Verify MS-DWSS requirement: MS-DWSS_R485
            this.Site.CaptureRequirementIfAreEqual<string>(
                "1",
                error.ID,
                485,
                @"[In CreateDwsResponse] ServerFailure, Identifier is ""1"", means: Protocol server encountered an error during the attempt to create the workspace.");
            
            if (Common.IsRequirementEnabled(1683, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R1683");
                
                // Verify MS-DWSS requirement: MS-DWSS_R1683
                this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                    ErrorTypes.ServerFailure,
                    error.Value,
                    1683,
                    @"[In Appendix B: Product Behavior] Implementation does return error ServerFailure when a site with the specified name already exists on this site. (<5> When a site with the specified name already exists on this site, Windows SharePoint Services 3.0, SharePoint Foundation 2010 and SharePoint Foundation 2013 will return error ServerFailure instead of AlreadyExists.)");
            }
            
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC08_RenameDws_ValidTitle()
        {
            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();

            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();
            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, dwsTitle, documents, out error);
            
            // Redirect the web service to the newly created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            string dwsNewTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();
            this.dwsAdapter.RenameDws(dwsNewTitle, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
            
            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(documents.Name, string.Empty, out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R554");
            
            // Verify MS-DWSS requirement: MS-DWSS_R554
            this.Site.CaptureRequirementIfAreEqual<string>(
                dwsNewTitle,
                getDwsDataRespResults.Title,
                554,
                @"[In GetDwsDataResponse] Title: The title of the workspace.");
            
            // Rename Document Workspace without title.
            this.dwsAdapter.RenameDws(null, out error);
            this.Site.Assert.IsNotNull(error, "The server should return an error!");
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC09_RenameDws_NoAccess()
        {
            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();

            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();
            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, dwsTitle, documents, out error);

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", 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);
            
            string dwsNewTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();
            this.dwsAdapter.RenameDws(dwsNewTitle, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be a NoAccess error.");
            
            // The precondition has verified this requirement already.
            this.Site.CaptureRequirement(
                299,
                @"[In RenameDwsResponse] Error: This element is returned when an error occurs in processing.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R294");
            
            // Verify MS-DWSS requirement: MS-DWSS_R294
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.NoAccess,
                error.Value,
                294,
                @"[In RenameDws] If the user submitting the request is not authorized to change the title, the protocol server MUST return an Error element with a NoAccess code.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R22");
            
            // Verify MS-DWSS requirement: MS-DWSS_R22
            this.Site.CaptureRequirementIfAreEqual<string>(
                "3",
                error.ID,
                22,
                @"[In Error] The value 3 [ID] matches the Error type NoAccess.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R295");
            
            // Verify MS-DWSS requirement: MS-DWSS_R295
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                295,
                @"[In RenameDws] The Error element MUST NOT contain an AccessUrl attribute.");
            
            // Set default Dws service credential to admin credential.
            userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            password = Common.GetConfigurationPropertyValue("Password", this.Site);
            domain = Common.GetConfigurationPropertyValue("Domain", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC07_CreateDws_ServerFailure()
        {
            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();

            string dwsName  = Common.GetConfigurationPropertyValue("SutComputerName", this.Site) + "_" + Common.FormatCurrentDateTime();
            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", this.Site) + "_" + Common.FormatCurrentDateTime();

            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(dwsName, users, dwsTitle, documents, out error);

            this.Site.Assert.IsNotNull(createDwsRespResults, "The server should return a CreateDws response!");

            // Set the name to the name returned by CreateDws operation.
            this.dwsAdapter.CreateDws(dwsName, users, dwsTitle, documents, out error);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R121");

            // Verify MS-DWSS requirement: MS-DWSS_R121
            this.Site.CaptureRequirementIfIsNotNull(
                error,
                121,
                @"[In CreateDws] The protocol server MUST reply with an Error element in the CreateDwsResponse response message if it fails to create the specified Document Workspace.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R682");

            // Verify MS-DWSS requirement: MS-DWSS_R682
            this.Site.CaptureRequirementIfIsNotNull(
                error,
                682,
                @"[In CreateDws] The protocol server MUST return a CreateDwsResponse response message with an Error element.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R458");

            // Verify MS-DWSS requirement: MS-DWSS_R458
            this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                458,
                @"[In CreateDws] If this is non-empty and another site (2) with the same name already exists on the site (2) on which the workspace is being created, the protocol server MUST return a ServerFailure error code (see section 2.2.3.2).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R485");

            // Verify MS-DWSS requirement: MS-DWSS_R485
            this.Site.CaptureRequirementIfAreEqual <string>(
                "1",
                error.ID,
                485,
                @"[In CreateDwsResponse] ServerFailure, Identifier is ""1"", means: Protocol server encountered an error during the attempt to create the workspace.");

            if (Common.IsRequirementEnabled(1683, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R1683");

                // Verify MS-DWSS requirement: MS-DWSS_R1683
                this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                    ErrorTypes.ServerFailure,
                    error.Value,
                    1683,
                    @"[In Appendix B: Product Behavior] Implementation does return error ServerFailure when a site (2) with the specified name already exists on this site (2). (<4> When a site (2) with the specified name already exists on this site (2), Windows SharePoint Services 3.0, SharePoint Foundation 2010 and SharePoint Foundation 2013 will return error ServerFailure instead of AlreadyExists.)");
            }

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC10_DeleteDws_DeleteCurrentSiteSuccessfully()
        {
            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);
            
            // Delete the created web site.
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not contains an error.");
            
            // If the response isn't an error, it indicate that the server returns a Result element
            this.Site.CaptureRequirement(
                166,
                @"[In DeleteDws] If none of the prior conditions apply, the protocol server MUST delete the specified Document Workspace and return a Result element.");
        }
        public void MSDWSS_S01_TC09_RenameDws_NoAccess()
        {
            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();

            string dwsTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();
            CreateDwsResultResults createDwsRespResults = this.dwsAdapter.CreateDws(string.Empty, users, dwsTitle, documents, out error);

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", 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);

            string dwsNewTitle = Common.GetConfigurationPropertyValue("ValidTitle", Site) + "_" + Common.FormatCurrentDateTime();

            this.dwsAdapter.RenameDws(dwsNewTitle, out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be a NoAccess error.");

            // The precondition has verified this requirement already.
            this.Site.CaptureRequirement(
                299,
                @"[In RenameDwsResponse] Error: This element is returned when an error occurs in processing.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R294");

            // Verify MS-DWSS requirement: MS-DWSS_R294
            this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                ErrorTypes.NoAccess,
                error.Value,
                294,
                @"[In RenameDws] If the user submitting the request is not authorized to change the title, the protocol server MUST return an Error element with a NoAccess code.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R22");

            // Verify MS-DWSS requirement: MS-DWSS_R22
            this.Site.CaptureRequirementIfAreEqual <string>(
                "3",
                error.ID,
                22,
                @"[In Error] The value 3 [ID] matches the Error type NoAccess.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R295");

            // Verify MS-DWSS requirement: MS-DWSS_R295
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                295,
                @"[In RenameDws] The Error element MUST NOT contain an AccessUrl attribute.");

            // Set default Dws service credential to admin credential.
            userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            password = Common.GetConfigurationPropertyValue("Password", this.Site);
            domain   = Common.GetConfigurationPropertyValue("Domain", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC12_DeleteDws_WebContainsSubwebs()
        {
            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 createDws1RespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, documents, out error);
            
            // Redirect the web service to the new created site.
            this.dwsAdapter.ServiceUrl = createDws1RespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            // create a SubSite
            CreateDwsResultResults createDws2RespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, documents, out error);
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsTrue(error.Value == ErrorTypes.WebContainsSubwebs, "The response is expected to be a WebContainsSubwebs error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R30");
            
            // Verify MS-DWSS requirement: MS-DWSS_R30
            this.Site.CaptureRequirementIfAreEqual<string>(
                "11",
                error.ID,
                30,
                @"[In Error] The value 11 [ID] matches the Error type WebContainsSubwebs.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R321");
            
            // Verify MS-DWSS requirement: MS-DWSS_R321
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                321,
                @"[In Error] This attribute [AccessUrl] MUST NOT be present when the Error element contains WebContainsSubwebs error code.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R163");
            
            // Verify MS-DWSS requirement: MS-DWSS_R163
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.WebContainsSubwebs,
                error.Value,
                163,
                @"[In DeleteDws] If the specified Document Workspace has sub sites, the protocol server MUST return an Error element with the WebContainsSubwebs error code.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R1671");
            
            // Verify MS-DWSS requirement: MS-DWSS_R1671
            // If error is not null, it indicate that the server did return an error element with a correct schema.
            this.Site.CaptureRequirementIfIsNotNull(
                error,
                1671,
                @"[In DeleteDwsResponse] Error: An Error element as specified in section 2.2.3.2.");
            
            // Redirect the web service to the sub site.
            this.dwsAdapter.ServiceUrl = createDws2RespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
            
            // Redirect the web service to the parent site.
            this.dwsAdapter.ServiceUrl = createDws1RespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC12_DeleteDws_WebContainsSubwebs()
        {
            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 createDws1RespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, documents, out error);

            // Redirect the web service to the new created site.
            this.dwsAdapter.ServiceUrl = createDws1RespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);

            // create a SubSite
            CreateDwsResultResults createDws2RespResults = this.dwsAdapter.CreateDws(string.Empty, users, string.Empty, documents, out error);

            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsTrue(error.Value == ErrorTypes.WebContainsSubwebs, "The response is expected to be a WebContainsSubwebs error.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R30");

            // Verify MS-DWSS requirement: MS-DWSS_R30
            this.Site.CaptureRequirementIfAreEqual <string>(
                "11",
                error.ID,
                30,
                @"[In Error] The value 11 [ID] matches the Error type WebContainsSubwebs.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R321");

            // Verify MS-DWSS requirement: MS-DWSS_R321
            this.Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(error.AccessUrl),
                321,
                @"[In Error] This attribute [AccessUrl] MUST NOT be present when the Error element contains WebContainsSubwebs error code.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R163");

            // Verify MS-DWSS requirement: MS-DWSS_R163
            this.Site.CaptureRequirementIfAreEqual <ErrorTypes>(
                ErrorTypes.WebContainsSubwebs,
                error.Value,
                163,
                @"[In DeleteDws] If the specified Document Workspace has sub sites, the protocol server MUST return an Error element with the WebContainsSubwebs error code.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R1671");

            // Verify MS-DWSS requirement: MS-DWSS_R1671
            // If error is not null, it indicate that the server did return an error element with a correct schema.
            this.Site.CaptureRequirementIfIsNotNull(
                error,
                1671,
                @"[In DeleteDwsResponse] Error: An Error element as specified in section 2.2.3.2.");

            // Redirect the web service to the sub site.
            this.dwsAdapter.ServiceUrl = createDws2RespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");

            // Redirect the web service to the parent site.
            this.dwsAdapter.ServiceUrl = createDws1RespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        public void MSDWSS_S01_TC13_DeleteDws_NoAccess()
        {
            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);

            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            
            // Set Dws service credential to Reader credential which does not have sufficient rights.
            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);
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R162");
            
            // Verify MS-DWSS requirement: MS-DWSS_R162
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.NoAccess,
                error.Value,
                162,
                @"[In DeleteDws] The protocol server MUST return an Error element with a NoAccess code if the authenticated user is not authorized to delete the Document Workspace.");
            
            // Set Dws service credential to a user who has sufficient permission to call DeleteDws operation.
            userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            password = Common.GetConfigurationPropertyValue("Password", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);
            
            // Redirect the web service to the site collection without sub sites.
            this.dwsAdapter.ServiceUrl = Common.GetConfigurationPropertyValue("SiteCollectionWithoutSubSite", this.Site);
            
            // Try to delete the site collection.
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be an error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R499");
            
            // Verify MS-DWSS requirement: MS-DWSS_R499
            this.Site.CaptureRequirementIfAreEqual<ErrorTypes>(
                ErrorTypes.ServerFailure,
                error.Value,
                499,
                @"[In DeleteDws] If the specified Document Workspace is the root site of the site collection, the protocol server MUST return an Error element with the ServerFailure error code.");
            
            // Redirect the web service to the created site.
            this.dwsAdapter.ServiceUrl = createDwsRespResults.Url + Common.GetConfigurationPropertyValue("TestDWSSSuffix", this.Site);
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The server should not return an error!");
        }
        /// <summary>
        /// The operation to create a new Document Workspace.
        /// </summary>
        /// <param name="dwsName">Specifies the name of the Document Workspace site, this parameter can be empty.</param>
        /// <param name="users">Specifies the users to be added as contributors in the Document Workspace site, this parameter can be null.</param>
        /// <param name="dwsTitle">Specifies the title of the workspace, this parameter can be empty.</param>
        /// <param name="docs">Specifies information to be stored as a key-value pair in the site metadata, this parameter can be null.</param>
        /// <param name="error">An error indication.</param>
        /// <returns>CreateDws operation response.</returns>
        public CreateDwsResultResults CreateDws(string dwsName, UsersItem users, string dwsTitle, DocumentsItem docs, out Error error)
        {
            // Serialize users object to xml string.
            string usersString = users == null ? string.Empty : AdapterHelper.XmlSerialize(users);

            // Serialize docs object to xml string.
            string docsString = docs == null ? string.Empty : AdapterHelper.XmlSerialize(docs);

            string respString = this.dwsService.CreateDws(dwsName, usersString, dwsTitle, docsString);

            // Decode response standalone xml string.
            string respXmlString = AdapterHelper.GenRespXmlString("CreateDwsResult", respString);

            // Validate response xml schema and capture the related requirements.
            this.ValidateCreateDwsResponseSchema(respXmlString);

            // Capture protocol transport related requirements.
            this.ValidateProtocolTransport();

            // Capture SOAP version related requirements.
            this.ValidateSoapVersion();

            // Deserialize response xml string to CreateDwsResult object.
            CreateDwsResult resp = AdapterHelper.XmlDeserialize<CreateDwsResult>(respXmlString);

            error = resp.Item as Error;

            if (resp.Item is CreateDwsResultResults)
            {
                // Validate the requirements related to Results element in CreateDwsResult element.
                this.ValidateCreateDwsResultResults(usersString, resp.Item as CreateDwsResultResults);
            }

            return resp.Item as CreateDwsResultResults;
        }
        public void MSDWSS_S05_TC03_RemoveDwsUser_NoAccess()
        {
            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);
            
            Results getDwsDataRespResults = this.dwsAdapter.GetDwsData(documents.Name, string.Empty, out error);
            this.Site.Assert.IsNull(error, "The response is expected to be a GetDwsDataResult not an error");
            this.Site.Assert.IsNotNull(getDwsDataRespResults.Members.Items, "The members not expected to be null");
            
            // Get first member
            Member firstMember = getDwsDataRespResults.Members.Items[0] as Member;
            this.Site.Assert.IsNotNull(firstMember, "The user should exist on server.");
            
            // 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);
            
            this.dwsAdapter.RemoveDwsUser(int.Parse(firstMember.ID), out error);
            this.Site.Assert.IsNotNull(error, "The response is expected to be a NoAccess error.");
            
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-DWSS_R22");
            
            // Verify MS-DWSS requirement: MS-DWSS_R22
            bool isVerifiedR22 = string.Equals("3", error.ID, StringComparison.CurrentCultureIgnoreCase) &&
                                 error.Value == ErrorTypes.NoAccess;
                
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR22,
                22,
                @"[In Error] The value 3 [ID] matches the Error type NoAccess.");
            
            // Set default Dws service credential to admin credential.
            userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            password = Common.GetConfigurationPropertyValue("Password", this.Site);
            domain = Common.GetConfigurationPropertyValue("Domain", this.Site);
            this.dwsAdapter.Credentials = new NetworkCredential(userName, password, domain);
            
            this.dwsAdapter.DeleteDws(out error);
            this.Site.Assert.IsNull(error, "The response should not be an error!");
        }