public void RouteUrlWithUrlRouteContext_ReturnsExpectedResult() { // Arrange var services = CreateServices(); 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); }
/// <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) { if (routeContext == null) { throw new ArgumentNullException(nameof(routeContext)); } var valuesDictionary = new RouteValueDictionary(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) { if (routeContext == null) { throw new ArgumentNullException(nameof(routeContext)); } var valuesDictionary = new RouteValueDictionary(routeContext.Values); var path = GeneratePathFromRoute(routeContext.RouteName, valuesDictionary); if (path == null) { return null; } return GenerateUrl(routeContext.Protocol, routeContext.Host, path, routeContext.Fragment); }
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); }
/// <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)); }