IControllerExpression IRouteDestinationExpression.Controller (Expression<Func<IServiceLocator, object>> controllerFunc) { var target = new RouteTarget(controllerFunc); _routes.Add(_path, target); return target; }
public void CanCreateRouteTargetFromType() { object obj = new object(); var mockServiceProvider = new Mock<IServiceLocator>(); mockServiceProvider.Setup(x => x.Get(typeof(object))).Returns(obj); Type t = typeof(object); var target = new RouteTarget(x => x.Get(typeof(object))); Assert.AreEqual(typeof(object), target.ControllerType); Assert.AreSame(obj, target.GetController(mockServiceProvider.Object)); }
void IStaticFilesExpression.FromResource(Func<VirtualPath, IServiceLocator, IResource> locator) { var target = new RouteTarget(svc => new StaticFileController(svc, locator)); _routes.Add(_path.Append("{path*}"), target); }