Unit Testing

Topics: Validation Application Block
Jan 24, 2011 at 4:52 PM

I have the following class:

public class LookupEntity
     public int Id { get; set; }
     public String Name { get; set; }

With the following validation rules (app.config):

  1. Id must be > 0
  2. Name cannot be NULL.
  3. Name.Length will be between 1 and 180

All that is very easy to setup and implement but I want to Unit Test that those validation rules are associated with LookupEntity.

In other words, I would like to know an easy way for me to implement Unit Testing that will fail if the validation rule for the property Name has been changed and now it accepts strings, for example, with Length > 180?


Jan 25, 2011 at 11:55 AM

Haven't tried this yet myself but i believe it is feasible. See this blog -http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=65 if it helps.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.