Exemplo n.º 1
0
        protected virtual void AutoFillRadioButtonGroup(string key, List <IWebElement> values)
        {
            string stringConstraintValue = null;

            if (_isSimpleSeed)
            {
                stringConstraintValue = GetStringFromValue(_seedWith);
            }
            else
            {
                object setValue = _constraintHelper.GetValue <object>(_seedWith, null, key);

                if (setValue != null)
                {
                    stringConstraintValue = GetStringFromValue(setValue);
                }
            }

            if (!string.IsNullOrEmpty(stringConstraintValue))
            {
                foreach (IWebElement webElement in values)
                {
                    if (webElement.GetAttribute(ElementContants.ValueAttribute) == stringConstraintValue)
                    {
                        webElement.Click();
                        return;
                    }
                }
            }

            var radioElement = _actionProvider.Generate <IRandomDataGeneratorService>().NextInSet(values);

            if (radioElement != null)
            {
                radioElement.Click();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Generate a random T
 /// </summary>
 /// <typeparam name="T">data type to generate</typeparam>
 /// <param name="requestName">request name to use</param>
 /// <param name="constraints">constraints for the generate</param>
 /// <returns>new type to generate</returns>
 public T Generate <T>(string requestName = null, object constraints = null)
 {
     return(_actionProvider.Generate <T>(requestName, constraints));
 }