I do not know if my question has any sense (I am new in testing), but I thought that I might want to check the ModelState without calling the controller. Example of my controller:
public ActionResult New(ClientModel client){
try{
if (ModelState.IsValid){
var result = _clienteAppService.Add(client);
if (result.IsValid){
return RedirectToAction("Index", new { id = client.ClienteId});
}
foreach (var error in result.Erros)
ModelState.AddModelError(erro.Name, erro.Message);
}
}
catch (Exception e){
ModelState.AddModelError(string.Empty, e.Message);
}
var errors = ModelState.Select(x => x.Value.Errors)
.Where(y => y.Count > 0).ToList();
ViewData["erros"] = errors;
return View(client);
}
What I mean is that I dont want to happen all of the things that I am doing in the controller, so like in this case add a new client, just check if model that I am sending is correct.
I want to do that because in my case calling the controller is quite time consuming in testing, and I dont want to call it for every scenario.