我使用Nunit作为我的单元测试框架,我创建了几个L2S实体和验证类。现在我想对验证进行单元测试,但我无法弄清楚如何做到这一点。
这是我的验证课程:
[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; }
}
这是我的实体:
[MetadataType(typeof(ProjectValidation))]
public partial class Project : IEntity {
}