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

MSADMINS_S01_TC01_CreateSiteDeleteSiteSuccessfully_FormatWithPortNumber() private method

        public void MSADMINS_S01_TC01_CreateSiteDeleteSiteSuccessfully_FormatWithPortNumber()
        {
            // 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 port number 80.
            int lcid = lcids.Languages[0];
            string title = TestSuiteBase.GenerateUniqueSiteTitle();
            string url = TestSuiteBase.GenerateUrlPrefixWithPortNumber() + 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 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 CreateSite operation succeed and the CreateSiteResult is not empty, MS-ADMINS_R1077001 can be captured.
            Site.CaptureRequirementIfIsFalse(
                string.IsNullOrEmpty(result),
                1077001,
                @"[In CreateSiteResponse]It[CreateSiteResult] MUST be returned if the CreateSite operation succeeds.");

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

            // Call DeleteSite method to delete the site collection created in above steps.
            this.adminsAdapter.DeleteSite(result);
            Site.Assert.Pass("The delete site method should succeed.");
           
            // The input parameter URL is an absolute URL of the site collection to be deleted and the DeleteSite method is successful, MS-ADMINS_R83 can be verified.
            Site.CaptureRequirement(
                83,
                @"[In DeleteSite]The [DeleteSiteSoapIn] request message MUST contain the absolute URL of the site collection to be deleted.");

            // The input parameter URL is an absolute URL of the site collection to be deleted and the DeleteSite method is successful, MS-ADMINS_R120 can be verified.
            Site.CaptureRequirement(
                120,
                @"[In DeleteSiteSoapIn][The request message is governed by the following rules:]The absolute URL of the site collection to be deleted MUST be included in the request message.");
        }
S01_CreateAndDeleteSite