public void OnAuthorization_NotAuthenticated_SetsNullResult()
        {
            ActionDescriptor     descriptor = Substitute.ForPartsOf <ActionDescriptor>();
            AuthorizationContext context    = new AuthorizationContext(controller.ControllerContext, descriptor);

            controller.ControllerContext.HttpContext.User.Identity.IsAuthenticated.Returns(false);

            controller.BaseOnAuthorization(context);

            Assert.Null(context.Result);
        }
Exemplo n.º 2
0
        public void OnAuthorization_SetsResultToNullThenNotLoggedIn()
        {
            ActionDescriptor     describtor    = Substitute.ForPartsOf <ActionDescriptor>();
            AuthorizationContext filterContext = new AuthorizationContext(controller.ControllerContext, describtor);

            controller.ControllerContext.HttpContext.User.Identity.IsAuthenticated.Returns(false);

            controller.BaseOnAuthorization(filterContext);

            Assert.IsNull(filterContext.Result);
        }