Ejemplo n.º 1
0
        public void OnAuthorizationThrowsIfFilterContextIsNull() {
            // Arrange
            AuthorizeAttribute attr = new AuthorizeAttribute();

            // Act & assert
            ExceptionHelper.ExpectArgumentNullException(
                delegate {
                    attr.OnAuthorization(null);
                }, "filterContext");
        }
 protected virtual bool VerifyAuthorizeAttribute(AuthorizeAttribute authorizeAttribute, ControllerContext controllerContext, ActionDescriptor actionDescriptor)
 {
     var authorizationContext = this.mvcContextFactory.CreateAuthorizationContext(controllerContext, actionDescriptor);
     authorizeAttribute.OnAuthorization(authorizationContext);
     if (authorizationContext.Result != null)
         return false;
     return true;
 }