HttpRouteEntry IDirectRouteProvider.CreateRoute(DirectRouteProviderContext context) { Contract.Assert(context != null); DirectRouteBuilder builder = context.CreateBuilder(Template); Contract.Assert(builder != null); builder.Name = Name; builder.Order = Order; HttpRouteValueDictionary builderConstraints = builder.Constraints; if (builderConstraints == null) { builder.Constraints = Constraints; } else { HttpRouteValueDictionary constraints = Constraints; if (constraints != null) { foreach (KeyValuePair <string, object> constraint in constraints) { builderConstraints.Add(constraint.Key, constraint.Value); } } } return(builder.Build()); }
private static IHttpRoute BuildWithoutResolver(string template, IEnumerable <HttpActionDescriptor> actions) { DirectRouteProviderContext context = new DirectRouteProviderContext(null, actions, new Mock <IInlineConstraintResolver>(MockBehavior.Strict).Object); DirectRouteBuilder builder = context.CreateBuilder(template, constraintResolver: null); return(builder.Build().Route); }
public HttpRouteEntry CreateRoute(DirectRouteProviderContext context) { Contract.Assert(context != null); DirectRouteBuilder builder = context.CreateBuilder(_infoProvider.Template); Contract.Assert(builder != null); builder.Name = _infoProvider.Name; builder.Order = _infoProvider.Order; return(builder.Build()); }
private static IHttpRoute BuildWithResolver(string template, IInlineConstraintResolver constraintResolver) { HttpActionDescriptor[] actions = new HttpActionDescriptor[] { new ReflectedHttpActionDescriptor() }; DirectRouteProviderContext context = new DirectRouteProviderContext(null, actions, constraintResolver); // Act DirectRouteBuilder builder = context.CreateBuilder(template); IHttpRoute route = builder.Build().Route; // Assertions for default, unspecified behavior: Assert.NotNull(route); Assert.Equal(actions, route.DataTokens["actions"]); return(route); }