Ejemplo n.º 1
0
        public void IsAuthorizedFor_NullAuthorization_ReturnsTrue()
        {
            Authorization.Provider = null;
            controller             = Substitute.ForPartsOf <BaseControllerProxy>();

            Assert.Null(controller.AuthorizationProvider);
            Assert.True(controller.IsAuthorizedFor(null, null, null));
        }
Ejemplo n.º 2
0
        public BaseControllerTests()
        {
            HttpContextBase context = HttpContextFactory.CreateHttpContextBase();

            Authorization.Provider = Substitute.For <IAuthorizationProvider>();

            controller = Substitute.ForPartsOf <BaseControllerProxy>();
            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.Controller  = controller;
            controller.ControllerContext.HttpContext = context;
            controller.ControllerContext.RouteData   =
                context.Request.RequestContext.RouteData;
            controller.Url = Substitute.For <UrlHelper>();

            controllerName = controller.RouteData.Values["controller"] as String;
            areaName       = controller.RouteData.Values["area"] as String;
        }