示例#1
0
        private Result <T, IError> TryGetValue <T>(
            string propertyName,
            Type stepType,
            Func <FreezableStepProperty, Result <T, IError> > extractValue)
        {
            var property = stepType.GetProperty(propertyName);

            if (property == null)
            {
                throw new Exception($"{stepType.Name} does not have property {propertyName}");
            }

            foreach (var reference in StepParameterReference.GetPossibleReferences(property))
            {
                if (StepProperties.TryGetValue(reference, out var value))
                {
                    return(extractValue(value));
                }
            }

            return(Result.Failure <T, IError>(
                       ErrorCode.MissingParameter.ToErrorBuilder(propertyName)
                       .WithLocation(new ErrorLocation(stepType.Name, Location))
                       ));
        }
示例#2
0
        public bool IsScopedFunction(string stepName, StepParameterReference stepParameterReference)
        {
            if (!Dictionary.TryGetValue(stepName, out var factory))
            {
                return(false);
            }

            return(factory.IsScopedFunction(stepParameterReference));
        }