Esempio n. 1
0
        public void SectoionControllerRedirectedToCorrectPage()
        {
            var requestDispatcherFactoryMock = new Mock <IRequestDispatcherFactory>();
            var routeNavigationServiceMock   = new Mock <IRouteNavigationService>();

            routeNavigationServiceMock.Setup(i => i.GetInitialRoute(It.IsAny <long?> ()))
            .Returns(new RouteInfo("GeneralInformationSection", 0));
            var patientAccessControlManagerMock = new Mock <IPatientAccessControlManager>();

            var assessmentController = new AssessmentController(requestDispatcherFactoryMock.Object,
                                                                routeNavigationServiceMock.Object,
                                                                patientAccessControlManagerMock.Object);

            var result = assessmentController.Edit(It.IsAny <long>());

            Assert.IsNotNull(result);
            var redirectToRouteResult = result as RedirectToRouteResult;

            Assert.AreEqual(redirectToRouteResult.RouteName, "SectionRoute");

            var routes = new RouteCollection();

            RouteConfig.RegisterRoutes(routes);
            RouteTestHelper.AssertRoute(routes, redirectToRouteResult.RouteValues, new { id = "0", section = "GeneralInformationSection" });
        }
Esempio n. 2
0
        public void RouteHasDefaultActionWhenUrlWithoutAction()
        {
            var routes = new RouteCollection();

            RouteConfig.RegisterRoutes(routes);

            RouteTestHelper.AssertRoute(routes, "~/patient", new { controller = "patient", action = "index" });
        }
Esempio n. 3
0
        public void CanMapNormalControllerActionRoute()
        {
            var routes = new RouteCollection();

            RouteConfig.RegisterRoutes(routes);

            var httpContextMock = new Mock <HttpContextBase>();

            httpContextMock.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath).Returns("~/patient/index");

            var routeData = routes.GetRouteData(httpContextMock.Object);

            Assert.IsNotNull(routeData);
            RouteTestHelper.AssertRoute(routes, routeData.Values, new { controller = "patient", action = "index" });
        }