Greetings,
I'm fairly new to TDD and ran across a unit test that I'm not entirely sure how to address.
Basically, I'm testing a couple of legacy class methods which read/write a binary stream to a file. The class functions take a serializable object as a parameter, which handles the actual reading/writing to the file.
For testing this, I was thinking that I would need a serialization mock object that I would pass to this function. My initial thought was to have the mock object hold onto a (char*) which would dynamically allocate memory and memcpy the data. However, it seems like the mock object might be doing too much work, and might be beyond the scope of this particular test.
Is my initial approach correct, or can anyone think of another way of correctly testing this?
Thanks!