Exemplo n.º 1
0
        /// <summary>
        /// Asserts that the API route exists, has the specified Http method and meets the expectations
        /// </summary>
        public static void HasApiRoute(HttpConfiguration config, string url, HttpMethod httpMethod, object expectations)
        {
            var propertyReader = new PropertyReader();
            var expectedProps = propertyReader.Properties(expectations);

            HasApiRoute(config, url, httpMethod, expectedProps);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Asserts that the route exists and meets expectations
 /// </summary>
 public static void HasRoute(RouteCollection routes, string url, object expectations)
 {
     var propertyReader = new PropertyReader();
     var expectedProps = propertyReader.Properties(expectations);
     HasRoute(routes, url, expectedProps);
 }
Exemplo n.º 3
0
        private static void ProcessActionParam(HttpParameterDescriptor param, HttpRouteData routeDataValues, Dictionary<string, string> result)
        {
            var propertyReader = new PropertyReader();

            if (propertyReader.IsSimpleType(param.ParameterType))
            {
                var paramName = param.ParameterName;
                AddParamWithRouteValue(paramName, routeDataValues.Values, result);
            }
            else
            {
                var fieldNames = propertyReader.SimplePropertyNames(param.ParameterType);
                foreach (var fieldName in fieldNames)
                {
                    AddParamWithRouteValue(fieldName.ToLowerInvariant(), routeDataValues.Values, result);
                }
            }
        }