title: Unit Testing & Primary Keys
body: <p>I am new to Unit Testing and think I might have dug myself into a corner.</p>
  
  <p>In your Unit Tests, what is the better way to handle primary keys?</p>
  
  <p>Hopefully an example will paint some context.  If create several instances of an object (Lets' say Person).</p>
  
  <p>My unit test is to test the correct relationships are being created.</p>
  
  <p>My code is to create Homer, he children Bart and Lisa.  He also has a friend Barney, Karl &amp; Lenny.</p>
  
  <p>I've seperated my data layer with an Interface.  My preference is to keep the primary key simple.  Eg On Save, Person.ProductID = new Random().Next(10000); instead of say Barney.PersonID = 9110  Homer.PersonID = 3243 etc.</p>
  
  <p>It doesn't matter what the primary key is, it just needs to be unique.</p>
  
  <p>Any thoughts???</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Sorry I haven't made it clear.  My project is setup to use <a href="http://en.wikipedia.org/wiki/Dependency_injection" rel="nofollow noreferrer">Dependency Injection</a>. The data layer is totally separate.  The focus of my question is, what is practical?</p>