serializing test objects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?a2thcnJl?=

    serializing test objects

    Hi all,
    We decided to clear the test db more frequently and I was asked to serialize
    som
    test objects to make sure our unit testing continues to work after clearing
    the db.

    Does anyone have any advice on how to implement this?
    I've decided on BinaryFormatter because I want to save private fields and
    ReadOnly-
    properties as well as Public Read/Write Properties.
    The objects are modeled as a hierarchi, maincompany, subcompany etc.
    Should I put them all in a collection and serialize it?
    If I serialize only the MainCompany, the other(lower) objects doesn't seem
    to be saved.

    Grateful for any tip!
    Best Regards,
    kk
  • sloan

    #2
    Re: serializing test objects


    I don't have a direct answer.

    But I have some source code that would make for a good test run in your
    situation.

    http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!114.entry

    I have objects,collect ions of objects, and collections of objects have have
    collections of objects.

    You would have to strip the Xml serialize stuff and try binary, but most of
    the work would be done.

    But it would give you some testing ideas.

    The children objects should definately serialize. A friendly reminder that
    everything needs to be tagged with the [Serilizable] attribute.

    ...

    Hopefully, someone else can chime in as well. But I thought I'd share what
    I have.

    ...


    "kkarre" <kkarre@discuss ions.microsoft. comwrote in message
    news:CF7DB553-3F20-4099-A8EE-7425D89C3361@mi crosoft.com...
    Hi all,
    We decided to clear the test db more frequently and I was asked to
    serialize
    som
    test objects to make sure our unit testing continues to work after
    clearing
    the db.
    >
    Does anyone have any advice on how to implement this?
    I've decided on BinaryFormatter because I want to save private fields and
    ReadOnly-
    properties as well as Public Read/Write Properties.
    The objects are modeled as a hierarchi, maincompany, subcompany etc.
    Should I put them all in a collection and serialize it?
    If I serialize only the MainCompany, the other(lower) objects doesn't seem
    to be saved.
    >
    Grateful for any tip!
    Best Regards,
    kk

    Comment

    Working...