private RouteValidationResult EnsureNoUnrecognizableSegments(Segment[] segments, RouteValueDictionary defaults, RouteValueDictionary constraints)
        {
            var unrecognized = segments.Where(x => SupportedSegmentTypes.Contains(x.GetType()) == false).ToList();

            return(unrecognized.Count > 0
                ? RouteValidationResult.Failure(string.Format("Unrecognized segment types were found. If using a custom segment type, please replace the IRouteValidator to enforce your own route validation rules. Unrecognized types: {0}", string.Join(", ", unrecognized.Select(x => "'" + x.GetType().Name + "'").ToArray())))
                : RouteValidationResult.Successful());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RouteValidator"/> class.
 /// </summary>
 public RouteValidator()
 {
     Rules.Add(EnsureNoUnrecognizableSegments);
     Rules.Add(EnsureNoMoreThanOneCatchAllSegment);
     Rules.Add(EnsureCatchAllOnlyAppearAtEnd);
     Rules.Add(EnsureParameterNamesAreUnique);
     SupportedSegmentTypes.Add(typeof(ParameterSegment));
     SupportedSegmentTypes.Add(typeof(LiteralSegment));
     SupportedSegmentTypes.Add(typeof(CatchAllParameterSegment));
 }