c# - How can I test ModelState?

c# - How can I test ModelState?

How can I test Controller.ViewData.ModelState? I would prefer to do it without any mock framework.…


asp.net mvc - Unit tests on MVC validation

How can I test that my controller action is putting the correct errors in the ModelState when validating an entity, when I'm using DataAnnotation validation in MVC 2 Preview 1? Some code to illustrate…


c# - Manually invoking ModelState validation

I'm using ASP.NET MVC 3 code-first and I have added validation data annotations to my models. Here's an example model: public class Product{public int ProductId{get; set;}[Required(Err…


asp.net mvc - Revalidating a modified ViewModel within a controller method?

EDIT-We're using MVC4 Dev Preview.... I'm implementing an edit page for a FishingTrip class. FishingTrip contains a child collection of simple Crew objects(i.e. FishingTripID, CrewID, CrewPosition…


c# - ASP.NET MVC TryValidateModel() Issues when Model is Modified

I have a two step form process where the first set of data is stored in session.[IsMp4File][Required(ErrorMessage="* Please select a video to upload")] public HttpPostedFileBase VideoClip{get; s…





tryvalidatemodel model validate mvc web unit test net modelstate isvalid