views:

74

answers:

0

I'm using Nunit as my unit testing framework and I've created a couple of L2S entities and validation classes. Now I want to unit test the validation, but I can't figure out how to do that.

This is my validation class:

[Bind(Exclude = "ProjectID")]
public class ProjectValidation {

    [Required(ErrorMessageResourceType = typeof(ValidationMessages), ErrorMessageResourceName = "RequiredProjectName")]
    [LocalizedDisplayName("ProjectName", NameResourceType = typeof(ValidationMessages))]
    public string Name { get; set; }

    [LocalizedDisplayName("StartDate", NameResourceType = typeof(ValidationMessages))]
    public DateTime StartDate { get; set; }

    [Required(ErrorMessageResourceType = typeof(ValidationMessages), ErrorMessageResourceName = "RequiredCustomer")]
    [LocalizedDisplayName("Customer", NameResourceType = typeof(ValidationMessages))]
    public int FK_CustomerId { get; set; }

    [LocalizedDisplayName("StartDate", NameResourceType = typeof(ValidationMessages))]
    public String Contact { get; set; }

}

And this is my Entity:

[MetadataType(typeof(ProjectValidation))]
public partial class Project : IEntity {
}