Inheritance: UCosmic.Www.Mvc.Controllers.MvcRoute
Example #1
0
 public void OutBoundUrl_OfActionWithNullArg_IsRoutedTo_UrlWithoutCatchall()
 {
     Expression<Func<ErrorsController, ActionResult>> action =
        controller => controller.NotAuthorized(null);
     var url = new ErrorsRouter.NotAuthorizedRoute().AlternateUrls.Single().ToAppRelativeUrl();
     OutBoundRoute.Of(action).InArea(Area).AppRelativeUrl().ShouldEqual(url);
 }
            public void InBoundUrl_WithAnyMethod_AndNoCatchall_IsRoutedTo_ActionWithNullArg()
            {
                Expression <Func <ErrorsController, ActionResult> > action =
                    controller => controller.NotAuthorized(null);
                var url = new ErrorsRouter.NotAuthorizedRoute().AlternateUrls.Single().ToAppRelativeUrl();

                url.WithAnyMethod().ShouldMapTo(action);
            }
            public void OutBoundUrl_OfActionWithNullArg_IsRoutedTo_UrlWithoutCatchall()
            {
                Expression <Func <ErrorsController, ActionResult> > action =
                    controller => controller.NotAuthorized(null);
                var url = new ErrorsRouter.NotAuthorizedRoute().AlternateUrls.Single().ToAppRelativeUrl();

                OutBoundRoute.Of(action).InArea(Area).AppRelativeUrl().ShouldEqual(url);
            }
Example #4
0
 public void Maps2Urls_FirstWithCatchall_ThenWithout()
 {
     var route = new ErrorsRouter.NotAuthorizedRoute();
     route.Url.ShouldEqual("errors/not-authorized-for/{*url}");
     route.AlternateUrls.ShouldNotBeNull();
     route.AlternateUrls.Count().ShouldEqual(1);
     route.AlternateUrls.Single().ShouldEqual("errors/403");
 }
            public void Maps2Urls_FirstWithCatchall_ThenWithout()
            {
                var route = new ErrorsRouter.NotAuthorizedRoute();

                route.Url.ShouldEqual("errors/not-authorized-for/{*url}");
                route.AlternateUrls.ShouldNotBeNull();
                route.AlternateUrls.Count().ShouldEqual(1);
                route.AlternateUrls.Single().ShouldEqual("errors/403");
            }
            public void OutBoundUrl_OfActionWithCatchallArg_IsRoutedTo_UrlWithCatchall()
            {
                const string attemptedUrl = "path/to/action";
                Expression <Func <ErrorsController, ActionResult> > action =
                    controller => controller.NotAuthorized(attemptedUrl);
                var url = new ErrorsRouter.NotAuthorizedRoute().Url.ToAppRelativeUrl()
                          .Replace("{*url}", attemptedUrl);

                OutBoundRoute.Of(action).InArea(Area).AppRelativeUrl().ShouldEqual(url);
            }
            public void InBoundUrl_WithAnyMethod_AndCatchall_IsRoutedTo_ActionWithCatchallArg()
            {
                const string attemptedUrl = "path/to/action";
                Expression <Func <ErrorsController, ActionResult> > action =
                    controller => controller.NotAuthorized(attemptedUrl);
                var url = new ErrorsRouter.NotAuthorizedRoute().Url.ToAppRelativeUrl()
                          .Replace("{*url}", attemptedUrl);

                url.WithAnyMethod().ShouldMapTo(action);
            }
Example #8
0
 public void InBoundUrl_WithAnyMethod_AndNoCatchall_IsRoutedTo_ActionWithNullArg()
 {
     Expression<Func<ErrorsController, ActionResult>> action =
        controller => controller.NotAuthorized(null);
     var url = new ErrorsRouter.NotAuthorizedRoute().AlternateUrls.Single().ToAppRelativeUrl();
     url.WithAnyMethod().ShouldMapTo(action);
 }
Example #9
0
 public void OutBoundUrl_OfActionWithCatchallArg_IsRoutedTo_UrlWithCatchall()
 {
     const string attemptedUrl = "path/to/action";
     Expression<Func<ErrorsController, ActionResult>> action =
        controller => controller.NotAuthorized(attemptedUrl);
     var url = new ErrorsRouter.NotAuthorizedRoute().Url.ToAppRelativeUrl()
         .Replace("{*url}", attemptedUrl);
     OutBoundRoute.Of(action).InArea(Area).AppRelativeUrl().ShouldEqual(url);
 }
Example #10
0
 public void InBoundUrl_WithAnyMethod_AndCatchall_IsRoutedTo_ActionWithCatchallArg()
 {
     const string attemptedUrl = "path/to/action";
     Expression<Func<ErrorsController, ActionResult>> action =
        controller => controller.NotAuthorized(attemptedUrl);
     var url = new ErrorsRouter.NotAuthorizedRoute().Url.ToAppRelativeUrl()
         .Replace("{*url}", attemptedUrl);
     url.WithAnyMethod().ShouldMapTo(action);
 }