I wrote a test that asserts that ModelState.IsValid is false but the test keeps failing. On closer examination, I find that ModelState.IfValid is always returning true for my controller tests. I had used Data annotations to mark up the model with required
attributes.
Pita.O
Member
41 Points
22 Posts
My ModelState remains valid in Controller test even when it's not.
Feb 25, 2010 04:15 PM|LINK
Hi everyone,
I wrote a test that asserts that ModelState.IsValid is false but the test keeps failing. On closer examination, I find that ModelState.IfValid is always returning true for my controller tests. I had used Data annotations to mark up the model with required attributes.
Am I missing anything?
ModelState