GenerateUrlWithoutPort() 공개 정적인 메소드

This method is used to generate random url without port number which includes [TransportType]://[SUTComputerName].
public static GenerateUrlWithoutPort ( int size ) : string
size int A parameter represents the random string size.
리턴 string
예제 #1
0
        public void MSADMINS_S02_TC01_CreateSiteFailed_UrlExceedMaxLength()
        {
            bool isSoapFaultReturn = false;

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

            int    lcid  = lcids.Languages[0];
            string title = TestSuiteBase.GenerateUniqueSiteTitle();
            string urlExceedMaxLength = TestSuiteBase.GenerateUrlWithoutPort(129);
            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();

            try
            {
                // Call CreateSite method to create a site collection with Url exceeding the max length.
                this.adminsAdapter.CreateSite(urlExceedMaxLength, title, description, lcid, webTemplate, ownerLogin, ownerName, ownerEmail, portalUrl, portalName);
            }
            catch (SoapException)
            {
                isSoapFaultReturn = true;
            }

            Site.Log.Add(LogEntryKind.Debug, "If the Soap fault returned when set the length of Url exceeding 128 characters, MS-ADMINS_R1028 can be verified.");

            // Verify MS-ADMINS requirement: MS-ADMINS_R1028
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultReturn,
                1028,
                @"[In CreateSiteSoapIn]If Url's length not including ""http://ServerName""  exceeds 128 characters, the server  MUST return a SOAP fault.");
        }