Microsoft.Protocols.TestSuites.MS_DWSS.S05_ManageSiteUsers.MSDWSS_S05_TC01_RemoveDwsUser_RemoveUserSuccessfully C# (CSharp) Method

MSDWSS_S05_TC01_RemoveDwsUser_RemoveUserSuccessfully() private method

        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!");
        }