public void Given() { var graph = new BehaviorGraph(); var chain = graph.AddActionFor("api/action1/{input}/", typeof (Action1)); _route = chain.Route; _property = ReflectionHelper.GetProperty<ActionRequest>(a => a.redfish); _result = ActionCallMapper.createParameter(_property, _route); }
public static Parameter createParameter(PropertyInfo propertyInfo, IRouteDefinition route) { var parameter = new Parameter { name = propertyInfo.Name, dataType = propertyInfo.PropertyType.Name, paramType = "post", allowMultiple = false, required = propertyInfo.HasAttribute<RequiredAttribute>(), description = propertyInfo.GetAttribute<DescriptionAttribute>(a => a.Description), defaultValue = propertyInfo.GetAttribute<DefaultValueAttribute>(a => a.Value.ToString()), allowableValues = getAllowableValues(propertyInfo) }; if (route.Input.RouteParameters.Any(r => r.Name == propertyInfo.Name)) parameter.paramType = "path"; if (route.Input.QueryParameters.Any(r => r.Name == propertyInfo.Name)) parameter.paramType = "query"; return parameter; }