public void OnAuthorizationThrowsIfFilterContextIsNull() { // Arrange ValidateInputAttribute attr = new ValidateInputAttribute(true); // Act & assert ExceptionHelper.ExpectArgumentNullException( delegate { attr.OnAuthorization(null); }, "filterContext"); }
public void OnAuthorizationSetsControllerValidateRequestToTrue() { // Arrange Controller controller = new EmptyController() { ValidateRequest = false }; ValidateInputAttribute attr = new ValidateInputAttribute(enableValidation: true); AuthorizationContext authContext = GetAuthorizationContext(controller); // Act attr.OnAuthorization(authContext); // Assert Assert.IsTrue(controller.ValidateRequest); }