title: Should Code Be in Unit Test or Integration Test
body: <p>First off, I am new at testing, so this may be a dumb question.  I am currently creating unit tests for my classes.  I have one property that depending on a nullable property will send off a new Comment object to the database. Usually with unit testing I would just make sure an object got sent to my Mock Service, and call it good.  However, would it not make more sense to test the values on the Comment Object to make sure it is going down the correct path, instead of just assuming it did. Here is a sample of the code I am testing:</p>
  
  <pre><code>if (DeliveryDate != null)
  {
     AddPartHistory("Delivery Date Changed from " + ((DateTime)DeliveryDate).ToShortDateString() + " to " + ((DateTime)value).ToShortDateString());
  }
  else
  {
     AddPartHistory("Delivered Date of " + ((DateTime)value).ToShortDateString() + " was added.");
  }
  </code></pre>
  
  <p>The <code>AddPartHistory</code> function sends the Comment object (which holds the text in a Property called Entry) to the database (or to a Mock Service during test), and stores it in a Property called <code>NewPartHistory</code>.  And here is the code that I believe may be more of an integration test:</p>
  
  <pre><code>vm.DeliveryDate = DateTime.UtcNow;
  Assert.AreEqual("Delivered Date of " + ((DateTime)vm.DeliveryDate).ToShortDateString() + " was added.", vm.NewPartHistory.Entry);
  
  OldDeliveryDate = vm.DeliveryDate;
  vm.DeliveryDate = DateTime.UtcNow;
  Assert.AreEqual("Delivery Date Changed from " + ((DateTime)OldDeliveryDate).ToShortDateString() + " to " + ((DateTime)vm.DeliveryDate).ToShortDateString(), vm.NewPartHistory.Entry);
  </code></pre>
  
  <p>So, back to the question, should I leave this code in the unit test, or move to integration test.</p>
  
  <h1>Update:</h1>
  
  <p>Since there was a lot of talk about my <code>AddPartHistory</code> Method, here it is. It simply fills out the standard data for a <code>PartHistory</code> (which is always the same), adds the Entry, and then updates a <code>Listview</code> with new data:</p>
  
  <pre><code>private void AddPartHistory(string historyText)
  {
     NewPartHistory = new CdaService.PartHistory();
     NewPartHistory.EnteredBy = User.Current.UID;
     NewPartHistory.Entry = historyText;
     NewPartHistory.EntryDate = DateTime.UtcNow;
     NewPartHistory.PartId = ThisPart.Id;
     webService.Insert(NewPartHistory);
     GetPartHistory();
  }
  </code></pre>