public void CaughtValidationExceptionHook() { ValidationFailureModel model = new ValidationFailureModel(); var result = model.Process(Request); Assert.IsTrue(result != null && result.Response != null && result.Status != null); Assert.IsTrue(result.Response is bool r && !r && result.Status == HttpStatusCode.BadRequest); }
public void CaughtModelStateValidationExceptionHook() { ModelStateDictionary modelState = new ModelStateDictionary(); modelState.AddModelError("RandomProperty", "has invalid characters."); ValidationFailureModel model = new ValidationFailureModel(); var result = model.Process(Request, modelState); Assert.IsTrue(result != null && result.Response != null && result.Status != null); Assert.IsTrue(result.Response is bool r && !r && result.Status == HttpStatusCode.BadRequest); }