title: unit testing / integration guidance for a shopping cart
body: <p>Need some guidance on how to go about unit testing a shopping cart (.net mvc, c#).</p>
  
  <p>I want to use sqllite as I am using nhibernate so I can create an in-memory version of my database for integration testing.</p>
  
  <p>So I have a Cart object:</p>
  
  <pre><code>public class Cart
  {
        void Add(Item item);
        void Delete(Item item);
  
        void CalculateTotalBLah();
  }
  </code></pre>
  
  <p>so the method Add might look like:</p>
  
  <pre><code>public void Add(Item item)
  {
       ItemDAO item = new SomeFactory();
  
       item.Add(item);
  }
  </code></pre>
  
  <p>So there are 2 things I have to test I guess:</p>
  
  <ol>
  <li>that the in-memory representation of the Cart object adds the item to the cart.</li>
  <li>the database is correctly in synch. with the in-memory object.</li>
  </ol>
  
  <p>The database test I believe is fairly straight forward.</p>
  
  <p>How do I test #1, how do I remove the dependancy of the db operations? Does nunit do this for me somehow?</p>