Beispiel #1
0
        /// <summary>
        /// Enters the first name.
        /// </summary>
        /// <param name="firstName">The first name.</param>
        /// <returns></returns>
        public virtual _CreateOrUpdateInfoComponent EnterFirstName(string firstName)
        {
            FirstNameElement.SetValue(firstName);

            return(this);
        }
        /// <summary>
        /// Searches using the search model.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">searchModel</exception>
        public virtual IListPage Search(CustomerSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            EmailElement.SetValue(searchModel.Email);
            FirstNameElement.SetValue(searchModel.FirstName);
            LastNameElement.SetValue(searchModel.LastName);

            if (searchModel.DateOfBirth.HasValue)
            {
                DateOfBirthMonthElement.SelectByValue(
                    searchModel.DateOfBirth.Value.Month.ToString());

                DateOfBirthDayElement.SelectByValue(
                    searchModel.DateOfBirth.Value.Day.ToString());
            }
            else
            {
                DateOfBirthMonthElement.SelectByIndex(0);
                DateOfBirthDayElement.SelectByIndex(0);
            }

            CompanyElement.SetValue(searchModel.Company);
            IpAddressElement.SetValue(searchModel.IpAddress);

            var currentlySelectedItems = CustomerRoles.GetSelectedOptions();

            if (searchModel.CustomerRoles != null)
            {
                foreach (var opt in currentlySelectedItems)
                {
                    if (!searchModel.CustomerRoles?.Contains(opt) ?? true)
                    {
                        CustomerRoles.DeselectItem(opt);
                    }

                    // Check if there are items that have yet to be selected.
                    if (searchModel.CustomerRoles?.Except(currentlySelectedItems).Any() ?? false)
                    {
                        foreach (var _opt in searchModel.CustomerRoles)
                        {
                            CustomerRoles.SelectItem(_opt);
                        }
                    }
                }
            }

            SearchElement.Click();

            // Wait for the ajax indicator to toggle.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .TrySequentialWait(
                out var exception,
                d => IsAjaxBusy(),
                d => !IsAjaxBusy());

            // Page should reload.
            Load();

            return(this);
        }
        /// <summary>
        /// Sets the first name.
        /// </summary>
        /// <param name="firstName">The first name.</param>
        /// <returns></returns>
        public virtual IAddressesCreateOrUpdatePage <T> SetFirstName(string firstName)
        {
            FirstNameElement.SetValue(firstName);

            return(this);
        }
        /// <summary>
        /// Sets the first name.
        /// </summary>
        /// <param name="firstName">The first name.</param>
        /// <returns></returns>
        public virtual IInfoPage SetFirstName(string firstName)
        {
            FirstNameElement.SetValue(firstName);

            return(this);
        }