Beispiel #1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var routeCollection = new LocalizationRouteCollection("~/pages/offer/details.aspx");

            routeCollection.AddTranslation("fr-FR", "offre-de-emploi/offre-{title}_{id}");
            routeCollection.AddTranslation("en-US", "job/job-{title}_{id}");
            RouteTable.Routes.Add("OfferDetails", routeCollection);

            var routeCollection2 = new LocalizationRouteCollection("~/pages/offer/list.aspx");

            routeCollection2.AddTranslation("fr-FR", "offre-de-emploi/liste-offre");
            routeCollection2.AddTranslation("en-US", "job/list-job");
            RouteTable.Routes.Add("OfferList", routeCollection2);
        }
Beispiel #2
0
        public void LocalizationRouteCollection_GetVirtualPathWithNullValues_ThrowsArgumentNullException()
        {
            var localizedRoute = new LocalizationRouteCollection("~/pages/offer/list.aspx");

            localizedRoute.AddTranslation("en-US", "job/job-list");
            localizedRoute.AddTranslation("fr-FR", "offre-de-emploi/liste-offre");

            var routes = new RouteCollection();

            routes.Add("OfferList", localizedRoute);

            var tester = new RouteTester(routes);

            using (new CultureScopedContext("en-US"))
            {
                tester.WithRouteInfo("OfferList").ShouldGenerateUrl("/job/job-list");
            }
            using (new CultureScopedContext("fr-FR"))
            {
                tester.WithRouteInfo("OfferList").ShouldGenerateUrl("/offre-de-emploi/liste-offre");
            }
        }