public override void OnActionExecuting(ActionExecutingContext context) { if (!context.ModelState.IsValid) { logger.LogError("Invalid View state detected"); var response = new InvalidViewStateResponse(context.ModelState); logger.LogError(response.Value?.ToString()); context.Result = response; } base.OnActionExecuting(context); }
public void Setup() { modelstatedictionary = new ModelStateDictionary(); modelstatedictionary.AddModelError("Error", "Test Error"); instance = CreateInvalidViewStateResponse(); }