Esempio n. 1
0
        /// <summary>
        /// get an instance of PassportUtils
        /// </summary>
        /// <param name="serviceUrl">The service URL.</param>
        /// <returns>the object of PassportUtils</returns>
        public static PassportLookUpProxy.PassportUtils.PassportUtils GetPassportUtilsInstance(string serviceUrl)
        {
            if (Helper.passportUtils == null)
            {
                Helper.passportUtils             = new PassportLookUpProxy.PassportUtils.PassportUtils();
                Helper.passportUtils.Url         = serviceUrl;
                Helper.passportUtils.Credentials = CredentialCache.DefaultNetworkCredentials;

                if (!string.IsNullOrEmpty(Helper.ProxyAddress))
                {
                    Helper.passportUtils.Proxy = new WebProxy(Helper.ProxyAddress, Helper.Port);
                }
            }

            return(Helper.passportUtils);
        }
Esempio n. 2
0
        /// <summary>
        /// Execute the ExecuteMExists test.
        /// </summary>
        /// <param name="tableName">Name of the table, denotes the name of method under testing.</param>
        private void ExecuteMExists(string tableName)
        {
            try
            {
                string serviceUrl = string.Empty;
                string msg        = string.Empty;
                long   low        = 0;
                long   high       = 0;

                if (this.ExecuteTest(tableName))
                {
                    serviceUrl         = this.Init(tableName);
                    this.passportUtils = Helper.GetPassportUtilsInstance(serviceUrl);
                    bool exists = this.passportUtils.MExists(Helper.InCurrentUsername, out high, out low, out msg);
                    this.LogHttpTrace();
                    this.WriteMeExistLog(msg, exists, tableName);
                }
                else
                {
                    Helper.AutomationDataProvider.Tables[PassportLookUpTestExecuter.MEXISTS].Rows[0][PassportLookUpTestExecuter.TESTRESULT] = PassportLookUpTestExecuter.NE;
                }
            }
            catch (Exception ex)
            {
                this.SetPassFail(tableName, Resources.Messages.msgFail);
                if (string.IsNullOrEmpty(Helper.AutomationDataProvider.Tables[tableName].Rows[0][Resources.Messages.xmlStrConsumedBy].ToString()))
                {
                    Helper.ResultStringContainer.AppendLine(ex.Message + Resources.Messages.ErrorEmptyConsumedBy);
                }
                else
                {
                    Helper.ResultStringContainer.AppendLine(ex.Message);
                }

                Helper.ResultStringContainer.AppendLine(Resources.Messages.msgFail);
            }

            Helper.ResultStringContainer.AppendLine(string.Empty);
        }