Microsoft.Protocols.TestSuites.MS_ADMINS.S01_CreateAndDeleteSite.MSADMINS_S01_TC02_CreateSiteDeleteSiteSuccessfully_FormatWithAdminPortNumber C# (CSharp) Method

MSADMINS_S01_TC02_CreateSiteDeleteSiteSuccessfully_FormatWithAdminPortNumber() private method

        public void MSADMINS_S01_TC02_CreateSiteDeleteSiteSuccessfully_FormatWithAdminPortNumber()
        {
            // Call GetLanguages method to obtain LCID values used in the protocol server deployment. 
            GetLanguagesResponseGetLanguagesResult lcids = this.adminsAdapter.GetLanguages();
            Site.Assert.IsNotNull(lcids, "Get languages should succeed and a list of LCIDs should return. If no LCID returns the get languages method is failed.");

            // Call CreateSite method to create a site collection with admin port number.
            int lcid = lcids.Languages[0];
            string title = TestSuiteBase.GenerateUniqueSiteTitle();
            string url = TestSuiteBase.GenerateUrlPrefixWithAdminPort() + title;
            string description = TestSuiteBase.GenerateRandomString(20);
            string webTemplate = Common.GetConfigurationPropertyValue("CustomizedTemplate", this.Site);
            string ownerLogin = Common.GetConfigurationPropertyValue("OwnerLogin", this.Site);
            string ownerName = TestSuiteBase.GenerateUniqueOwnerName();
            string ownerEmail = TestSuiteBase.GenerateEmail(20);
            string portalUrl = TestSuiteBase.GeneratePortalUrl(20);
            string portalName = TestSuiteBase.GenerateUniquePortalName();

            string result = this.adminsAdapter.CreateSite(url, title, description, lcid, webTemplate, ownerLogin, ownerName, ownerEmail, portalUrl, portalName);
           
            // The input parameter URL is an absolute URL of the site collection to be created and the CreateSite method is successful, MS-ADMINS_R13 can be verified.
            Site.CaptureRequirementIfIsTrue(
                Uri.IsWellFormedUriString(result, UriKind.Absolute),
                13,
                @"[In CreateSiteSoapIn][The request message is governed by the following rules:]The absolute URL of the site collection to be created MUST be included in the request message.");

            // The input parameter OwnerLogin is given a valid value and the CreateSite method is successful, MS-ADMINS_R22 can be verified.
            Site.CaptureRequirementIfIsTrue(
                Uri.IsWellFormedUriString(result, UriKind.Absolute),
                22,
                @"[In CreateSiteSoapIn]The valid OwnerLogin MUST be included in the request message.");

            // The input parameter URL is formatted as http://ServerName:PortNumber/sites/SiteCollectionName and the CreateSite operation succeed, MS-ADMINS_R3043 can be captured.
            Site.CaptureRequirementIfIsTrue(
                 Uri.IsWellFormedUriString(result, UriKind.Absolute),
                 3043,
                 @"[In CreateSite]If the Url contains the port number, the Url format is http://ServerName:PortNumber/sites/SiteCollectionName.");

            // The input parameter URL is formatted as http://ServerName:PortNumber/sites/SiteCollectionName and the CreateSite operation succeed, MS-ADMINS_R2042002 can be captured.
            Site.CaptureRequirement(
                 2042002,
                 @"[In CreateSite]PortNumber in the [Url's] first format [http://ServerName:PortNumber/sites/SiteCollectionName] MUST be the port number used by or the Administration Web Service on the protocol server.");

            // Call DeleteSite method to delete the site collection created in above steps.
            this.adminsAdapter.DeleteSite(result);
        }
S01_CreateAndDeleteSite