Matt Scilipoti's WebLog

.NET et al

UnitTesting internals... again. rubot: smack mmscili

I am building an app to help me journal my time.  It is similar to a blog (eventually may feed a blog).  After creating JournalEntry and JournalEntryCollecition.  I wanted to persist the collection. 

My initial testing thoughts were:

  1. Serialization is simplest way.
  2. How to test serialize works?
    1. Make sure file isn't there.
    2. Add Entry (should serialize automatically)
    3. Test for file existence.

This lead to:

    1. How do I know file name? Don't know
    2. Should I send it in? or should object publish it?
    3. Let's base it on a guid (.xml).
    4. Added guid to JournalEntry.
    5. Duh. We are serializing the collection into a file, not individual items to each file.
    6. Add guid to Collection?  Wait, let's think again.
    7. Eureka.  Forget all this complicated crap.

Final test:

    1. Create Collection, add item, kill collection.  Create new collection, hydrate, test item.

There was no need to test internals.  For now, I assume the collection always has all the entries.

Only issue: I am actually testing the save and load at the same time. Hmm.

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)