I have an action in my controller:
RedirectToRouteResult Create(UserDTO UserDTO)
Which at some point decides which HTML to respond with after the mail request, redirecting to the action:
return ModelState.IsValid ? RedirectToAction("ThanksCreate") : RedirectToAction("Register");
In my unit tests, I would like to get a view of "model modelstates" something like this:
var modelState = result.ViewData.ModelState;
Assert.IsFalse( modelState.IsValid );
where 'result (ViewResult) is the result of the' Create action, depending on the presented DTO. My dilemma is that my action "returns a RedirectToRouteResult, which I thought was pretty nice, but it might not be verifiable or could it?"
How can I get a ModelState in my script? Thank.
Regards,
Christian
enter code here