When testing my controller\'s actions the ModelState is always valid.
public class Product { public int Id { get; set; } [Required] [StringLengt
the modelState always give false
controller.ModelState.AddModelError("key", "error message"); var invalidStateResult = _controller.Index(); Assert.IsNotNull(invalidStateResult);