예제 #1
0
        /// <summary>
        /// Execute GetPuid Test.
        /// </summary>
        /// <param name="tableName">Name of the table, denotes the name of method under testing.</param>
        private void ExecuteGetPuid(string tableName)
        {
            try
            {
                string serviceUrl = string.Empty;
                int    low = 0, high = 0;
                string err = string.Empty;

                if (this.ExecuteTest(tableName))
                {
                    serviceUrl = this.Init(tableName);
                    this.passportLookupService = Helper.GetPassportLookupServiceInstance(serviceUrl);
                    this.passportLookupService.GetPuid(Helper.InCurrentUsername, Convert.ToInt32(Helper.InTimeout), out low, out high, out err);
                    this.LogHttpTrace();
                    this.WriteToLog(low, high, err, tableName);
                }
            }
            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);
        }
예제 #2
0
        /// <summary>
        /// ExecuteAuthenticate API test, to authenticate a passport user.
        /// </summary>
        /// <param name="tableName">tableName denotes the name of method under testing</param>
        private void ExecuteAuthenticate(string tableName)
        {
            bool   authenticated = false;
            string serviceUrl    = string.Empty;

            try
            {
                if (this.ExecuteTest(tableName))
                {
                    serviceUrl = this.Init(tableName);
                    this.passportLookupService = Helper.GetPassportLookupServiceInstance(serviceUrl);
                    authenticated = this.passportLookupService.Authenticate(Helper.InCurrentUsername, Helper.InPassword, Helper.InTimeout);
                    this.LogHttpTrace();
                    this.WriteToLog(authenticated, tableName);
                }
            }
            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 + "\n" + Resources.Messages.ErrorEmptyConsumedBy);
                }
                else
                {
                    Helper.ResultStringContainer.AppendLine(ex.Message);
                }

                this.WriteToLog(authenticated, tableName);
            }

            Helper.ResultStringContainer.AppendLine(string.Empty);
        }
예제 #3
0
        /// <summary>
        /// Get an instance of PassportLookupService
        /// </summary>
        /// <param name="serviceUrl">The service URL.</param>
        /// <returns>the object of PassportLookupService</returns>
        public static PassportLookUpProxy.PassportLookupAdapter.PassportLookupService GetPassportLookupServiceInstance(string serviceUrl)
        {
            Helper.passportLookupService             = new PassportLookUpProxy.PassportLookupAdapter.PassportLookupService();
            Helper.passportLookupService.Url         = serviceUrl;
            Helper.passportLookupService.Credentials = CredentialCache.DefaultNetworkCredentials;

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

            return(Helper.passportLookupService);
        }
예제 #4
0
        /// <summary>
        /// Execute CheckAvailableSigninName Test.
        /// </summary>
        /// <param name="tableName">Name of the table, denotes the name of method under testing.</param>
        private void ExecuteCheckAvailableSigninName(string tableName)
        {
            try
            {
                string serviceUrl      = string.Empty;
                string errorXml        = string.Empty;
                bool   successful      = false;
                bool   signInNameExist = false;
                if (this.ExecuteTest(tableName))
                {
                    serviceUrl = this.Init(tableName);
                    this.passportLookupService = Helper.GetPassportLookupServiceInstance(serviceUrl);

                    if (!this.createPassportSucesseded)
                    {
                        this.passportUser = Helper.InCurrentUsername;
                    }

                    successful = this.passportLookupService.CheckAvailableSigninName(this.passportUser, Convert.ToInt32(Helper.InTimeout), out errorXml);
                    this.LogHttpTrace();

                    if (!successful)
                    {
                        signInNameExist = true;
                    }

                    this.WriteToLogAvailableSignIn(errorXml, signInNameExist, tableName);
                }
            }
            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);
        }
예제 #5
0
        /// <summary>
        /// Execute CreatePassport test.
        /// </summary>
        /// <param name="tableName">Name of the table, denotes the name of method under testing.</param>
        private void ExecuteCreatePassport(string tableName)
        {
            try
            {
                string serviceUrl = string.Empty;
                string errorXml   = string.Empty;

                if (this.ExecuteTest(tableName))
                {
                    serviceUrl = this.Init(tableName);
                    this.passportLookupService = Helper.GetPassportLookupServiceInstance(serviceUrl);
                    this.SetUserName();

                    string userCreated = this.passportLookupService.CreatePassport(this.userName, Helper.InSecretQuestion, Helper.InSecretAnswer, Helper.InPassword, Helper.InBirthDate, Helper.InLanguagePreference, Helper.InTimeZone, Helper.InFirstName, Helper.InLastName, Helper.InOccupation, Helper.InCountry, Convert.ToString(Helper.InPostalCode), Helper.InGender, Convert.ToString(Helper.InRegionCode), Convert.ToInt32(Helper.InTimeout), out errorXml);

                    if (!string.IsNullOrEmpty(userCreated))
                    {
                        Helper.InCurrentUsername = this.userName;
                    }

                    this.LogHttpTrace();
                    this.WriteToLogCreatePassport(errorXml, userCreated, tableName);
                }
            }
            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);
        }
예제 #6
0
        /// <summary>
        /// Execute GetPuidForValidateAccount API test to validate the user and return PUID.
        /// </summary>
        /// <param name="tableName">tableName denotes the name of method under testing</param>
        private void ExecuteGetPuidForValidateAccount(string tableName)
        {
            try
            {
                string serviceUrl = string.Empty;
                string errorXml = string.Empty;
                int    low = 0, high = 0;

                if (this.ExecuteTest(tableName))
                {
                    serviceUrl = this.Init(tableName);
                    this.passportLookupService = Helper.GetPassportLookupServiceInstance(serviceUrl);
                    this.passportLookupService.GetPuidForValidateAccount(Helper.InCurrentUsername, Convert.ToInt32(Helper.InTimeout), out low, out high);
                    this.LogHttpTrace();
                    this.WriteToLogPuidForValidAccount(errorXml, low, high, tableName);
                }
                else
                {
                    Helper.AutomationDataProvider.Tables[PassportLookUpTestExecuter.GETPUIDFORVALIDATEACCOUNT].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);
        }
예제 #7
0
        /// <summary>
        /// Executes RenameCredential API test and after test completed, it revert the credentials.
        /// </summary>
        /// <param name="tableName">tableName denotes the name of method under testing</param>
        private void ExecuteRenameCredential(string tableName)
        {
            try
            {
                string serviceUrl = string.Empty;
                string errorXml   = string.Empty;

                string newUserName = Helper.InNewUsername;

                // Auto sets newUserName value if no value provided in xml
                if (string.IsNullOrEmpty(newUserName))
                {
                    newUserName = "******" + Helper.InCurrentUsername;
                }

                if (this.ExecuteTest(tableName))
                {
                    serviceUrl = this.Init(tableName);
                    this.passportLookupService = Helper.GetPassportLookupServiceInstance(serviceUrl);

                    bool credentialRenamed = this.passportLookupService.RenameCredential(Helper.InCurrentUsername, newUserName, Convert.ToInt32(Helper.InTimeout), out errorXml);
                    this.LogHttpTrace();
                    this.WriteToLog(errorXml, credentialRenamed, tableName, newUserName);

                    bool revert = Helper.AutomationDataProvider.RenameCredential[0].RevertChange;

                    if (revert)
                    {
                        ////Revert the credential (Taken from WriteToLog(string errorXml, bool rem, string tableName, string newUserName))
                        bool a = this.passportLookupService.RenameCredential(newUserName, Helper.InCurrentUsername, Convert.ToInt32(Helper.InTimeout), out errorXml);
                        if (a)
                        {
                            Helper.ResultStringContainer.AppendLine("Credential reverted back sucessfully.");
                        }
                        else
                        {
                            Helper.ResultStringContainer.AppendLine("Failed to revert credential.");

                            if (errorXml != null)
                            {
                                Helper.ResultStringContainer.AppendLine(errorXml);
                            }
                        }
                    }
                }
            }
            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);
        }