Пример #1
0
        public static T ParameterValue <T>(this TestApplication application, string parameterName, T defaultValue)
        {
            var paramValue = application.FindParamValue(parameterName);
            T   result;

            if (!XpandConvert.TryToChange(paramValue, out result))
            {
                throw new EasyTestException(string.Format("Cannot retrieve the '{0}' attribute's value for the '{1}' application", parameterName, application.Name));
            }
            return(result);
        }
Пример #2
0
        public static T ParameterValue <T>(this Command command, string parameterName, T defaultValue)
        {
            T         result    = defaultValue;
            Parameter parameter = command.Parameters[parameterName];

            if (parameter != null)
            {
                if (!XpandConvert.TryToChange(parameter.Value, out result))
                {
                    throw new CommandException($"'{parameterName}' value is incorrect", command.StartPosition);
                }
            }
            return(result);
        }
Пример #3
0
        public static T ParameterValue <T>(this Command command, T defaultValue)
        {
            T   result    = defaultValue;
            var parameter = command.Parameters.MainParameter;

            if (parameter != null)
            {
                if (!XpandConvert.TryToChange(parameter.Value, out result))
                {
                    throw new CommandException("\'MainParameter\' value is incorrect", command.StartPosition);
                }
            }
            return(!result.Equals(default(T)) ? result : defaultValue);
        }