public void RouteUrlWithUrlRouteContext_ReturnsExpectedResult() { // Arrange var services = GetServices(); var urlHelper = CreateUrlHelperWithRouteCollection(services, "/app"); var routeContext = new UrlRouteContext() { RouteName = "namedroute", Values = new { Action = "newaction", Controller = "home2", id = "someid" }, Fragment = "somefragment", Host = "remotetown", Protocol = "ftp" }; // Act var url = urlHelper.RouteUrl(routeContext); // Assert Assert.Equal("ftp://remotetown/app/named/home2/newaction/someid#somefragment", url); }
public string RouteUrl(UrlRouteContext routeContext) { Assert.Equal(_routeName, routeContext.RouteName); Assert.Null(routeContext.Protocol); Assert.Null(routeContext.Host); Assert.Null(routeContext.Fragment); RouteValues = routeContext.Values; return(_url); }
/// <inheritdoc /> public virtual string RouteUrl(UrlRouteContext routeContext) { var valuesDictionary = PropertyHelper.ObjectToDictionary(routeContext.Values); var path = GeneratePathFromRoute(routeContext.RouteName, valuesDictionary); if (path == null) { return null; } return GenerateUrl(routeContext.Protocol, routeContext.Host, path, routeContext.Fragment); }
/// <inheritdoc /> public virtual string RouteUrl(UrlRouteContext routeContext) { var valuesDictionary = PropertyHelper.ObjectToDictionary(routeContext.Values); var path = GeneratePathFromRoute(routeContext.RouteName, valuesDictionary); if (path == null) { return(null); } return(GenerateUrl(routeContext.Protocol, routeContext.Host, path, routeContext.Fragment)); }
public override string RouteUrl(UrlRouteContext routeContext) { return ConvertToLowercaseUrl(base.RouteUrl(routeContext)); }
public string RouteUrl(UrlRouteContext routeContext) { Assert.Equal(_routeName, routeContext.RouteName); Assert.Null(routeContext.Protocol); Assert.Null(routeContext.Host); Assert.Null(routeContext.Fragment); RouteValues = routeContext.Values; return _url; }