GenerateRandomNumber() 공개 정적인 메소드

This method is used to random generate an integer in the specified range.
public static GenerateRandomNumber ( int minValue, int maxValue ) : int
minValue int The inclusive lower bound of the random number returned.
maxValue int The exclusive upper bound of the random number returned.
리턴 int
예제 #1
0
        public void MSADMINS_S02_TC09_CreateSiteFailed_LcidInvalid()
        {
            string strErrorCode = string.Empty;
            int    invalidLcid  = TestSuiteBase.GenerateRandomNumber(0, 99);
            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();

            try
            {
                // Call CreateSite to create a site collection with an invalid LCID.
                this.adminsAdapter.CreateSite(url, title, description, invalidLcid, webTemplate, ownerLogin, ownerName, ownerEmail, portalUrl, portalName);
            }
            catch (SoapException exp)
            {
                strErrorCode = Common.ExtractErrorCodeFromSoapFault(exp);
                Site.Log.Add(LogEntryKind.Debug, "Soap exception returned, it means the create site operation failed with invalid LCID inputting, the message is: {0}", exp.Message);
            }

            // If the returned error code equals to 0x8102005e, then MS-ADMINS_R18 can be captured.
            Site.CaptureRequirementIfAreEqual <string>(
                "0x8102005e",
                strErrorCode,
                18,
                @"[In CreateSiteSoapIn] If the LCID is invalid [or not installed], then the server MUST return a SOAP fault with error code 0x8102005e.");
        }
        public void MSADMINS_S02_TC09_CreateSiteFailed_LcidInvalid()
        {
            int    invalidLcid = TestSuiteBase.GenerateRandomNumber(0, 99);
            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();

            try
            {
                // Call CreateSite to create a site collection with an invalid LCID.
                this.adminsAdapter.CreateSite(url, title, description, invalidLcid, webTemplate, ownerLogin, ownerName, ownerEmail, portalUrl, portalName);
            }
            catch (SoapException exp)
            {
                Site.Log.Add(LogEntryKind.Debug, "Soap exception returned, it means the create site operation failed with invalid LCID inputting, the message is: {0}", exp.Message);
            }
        }